Created
May 30, 2012 01:17
-
-
Save fjolnir/2832103 to your computer and use it in GitHub Desktop.
The weirdest macro expansion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define TQAssertSoft(cond, domain, code, fmt, ...) \ | |
do { \ | |
if(!(cond)) { \ | |
if(aoError) \ | |
*aoError = [NSError errorWithDomain:(domain) code:(code) userInfo:nil]; \ | |
TQLog(fmt, ##__VA_ARGS__); \ | |
return NO; \ | |
} \ | |
} while(0) | |
TQAssertSoft(aArgument.identifier == nil, | |
kTQSyntaxErrorDomain, kTQUnexpectedIdentifier, | |
@"First argument of a block can not have an identifier"); | |
/* | |
Results in: | |
TQSyntaxTree.m:91:3: warning: class method '+errorWithDomain:kTQUnexpectedIdentifier:userInfo:' not found (return type defaults to 'id') | |
TQAssertSoft(aArgument.identifier == nil, | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
./TQSyntaxTree.h:28:16: note: expanded from: | |
*aoError = [NSError errorWithDomain:(domain) code:(code) userInfo:nil]; \ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment