Skip to content

Commit

Permalink
Wrap static _##ENUM_TYPENAME##_constants_string var in `_Pragma("cl…
Browse files Browse the repository at this point in the history
…ang diagnostic ignored \"-Wunused-value\"")` to suppress "Unused variable" warnings as pointed out in #3.

Pretty sure these warnings didn't show up with the version of Xcode/clang that I wrote JREnum with.

Anyway, this is kinda academic since a couple of versions back `_Pragma("clang diagnostic ignored \"-Wunused-value\"")` stopped working. I'm putting this in here anyway hoping it starts working again in a future version of clang.
  • Loading branch information
rentzsch committed Apr 25, 2013
1 parent aec3b77 commit f5d4141
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion JREnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
extern NSDictionary* ENUM_TYPENAME##ByLabel(); \
extern NSString* ENUM_TYPENAME##ToString(int enumValue); \
extern BOOL ENUM_TYPENAME##FromString(NSString *enumLabel, ENUM_TYPENAME *enumValue); \
static NSString *_##ENUM_TYPENAME##_constants_string = @"" #ENUM_CONSTANTS;
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wunused-value\"") \
static NSString *_##ENUM_TYPENAME##_constants_string = @"" #ENUM_CONSTANTS; \
_Pragma("clang diagnostic pop")

#define JREnumDefine(ENUM_TYPENAME) \
_JREnum_GenerateImplementation(ENUM_TYPENAME)
Expand Down

0 comments on commit f5d4141

Please sign in to comment.