dmd
dmd copied to clipboard
ImportC: add __check(assign-expression) extension
Trying to use assert
in ImportC without the preprocessor gets tiresome, so I added __assert as an extension.
Thanks for your pull request, @WalterBright!
Bugzilla references
Your PR doesn't reference any Bugzilla issue.
If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub run digger -- build "master + dmd#14026"
the name __assert is already used for the assert failure function on some platforms (see druntime core.stdc.assert for a list)
if it's made a keyword, the assert header and uses of the macro will fail to parse
$ cpp /usr/include/assert.h > assert.i
$ dmd -verrors=context assert.i
/usr/include/assert.h(81): Error: identifier or `(` expected
extern void __assert (const char *__assertion, const char *__file, int __line)
^
Curses! Any ideas for a replacement keyword for __assert
?
How about _Assert
?
Changed __assert
to __check
Changed
__assert
to__check
I already dumped my thoughts on using known keywords for reserved identifiers in C when __import
got merged. __
is reserved and we better have a tiny prefix to avoid such conflicts, but well we got to deal with it someday.
ping @WalterBright
I want to make a new suggestion to you; if the English meaning is not contradictory!
"ascertain" that can't introduce new conflicts never?
assert(true);
ascertain(true);
Sounds good, huh? Okay, it's 3 letters more but it is better than underscore typed by double key press.:)
SDB@79
@WalterBright what is the status of this PR?
@WalterBright is this good to go?
Ready to merge
@WalterBright @RazvanN7 How do we know this works? The test is never ran by the testsuite!