Skip to content

Instantly share code, notes, and snippets.

@qnoid
Last active December 15, 2015 13:49
Show Gist options
  • Save qnoid/5269777 to your computer and use it in GitHub Desktop.
Save qnoid/5269777 to your computer and use it in GitHub Desktop.
How to use [diagnostic pragmas][1] to annotate a class/method so as to show a message on compile. [1]: http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html PS. Tested on XCode 4.6.1 http://i.minus.com/iepXiFcByxuKt.png
#define DO_PRAGMA(x) _Pragma (#x)
#define MESSAGE(x) DO_PRAGMA(message (x))
@interface TBFoo : NSObject
@end
@implementation TBFoo
-(void)bar MESSAGE("Hello World!"){}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment