Skip to content

Add default args to Define and make elselines optional in IfNdef/Ifdef#24

Open
lokraszewski wants to merge 3 commits intoinducer:mainfrom
lokraszewski:master
Open

Add default args to Define and make elselines optional in IfNdef/Ifdef#24
lokraszewski wants to merge 3 commits intoinducer:mainfrom
lokraszewski:master

Conversation

@lokraszewski
Copy link

Some quality of life improvements. This allows you to write a common include guard pattern such as:

test = c.IfNDef('__HEADER__', 
	[
		c.Define('__HEADER__'), 
		c.Comment("Header content")
	])

print(test)

Which results in:

#ifndef __HEADER__
#define __HEADER__
/* Header content */
#endif

Also added some test for the new ifndef/ifdef functionality.

@lokraszewski
Copy link
Author

@inducer let me know what you think of this! 😄

Base automatically changed from master to main March 8, 2021 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant