Permalink
Browse files

Macros now expect quoted C-strings and won't stringize their paramete…

…r anymore.

(This makes syntactic coloration better when using the macros)
  • Loading branch information...
1 parent bb47f42 commit 8f38d302eef19746f06d9610d2221c488ae2566a @AliSoftware committed Oct 2, 2012
Showing with 16 additions and 14 deletions.
  1. +16 −14 TODOMacros.h
View
@@ -7,24 +7,26 @@
#define GENERATE_PRAGMA(x) _Pragma(#x)
-/*
- * Usage: Use TODO("some message") / FIXME("some message") / NOTE("some message") to generate appropriate warnings
- */
-#define TODO(x) GENERATE_PRAGMA(message("[TODO] " #x))
-#define FIXME(x) GENERATE_PRAGMA(message("[FIXME] " #x))
-#define NOTE(x) GENERATE_PRAGMA(message("[NOTE] " #x))
+/* Usage: Use TODO("some message") / FIXME("some message") / NOTE("some message") to generate appropriate warnings */
+#define TODO(x) GENERATE_PRAGMA(message("[TODO] " x))
+#define FIXME(x) GENERATE_PRAGMA(message("[FIXME] " x))
+#define NOTE(x) GENERATE_PRAGMA(message("[NOTE] " x))
/* Usage example:
- * view.frame = CGRectMake(0, 0, MAGIC_NUMBER(77), MAGIC_NUMBER(90));
- * // will warn you that you should replace values 77 and 90 with constants later, because magic numbers are bad.
+ * view.frame = CGRectMake(0, 0, MAGIC_NUMBER(77), MAGIC_NUMBER(90));
+ *
+ * It will warn you that you should replace values 77 and 90 with constants later, because magic numbers are bad.
*/
-#define MAGIC_NUMBER(x) (({ FIXME(Replace magic number x with constant) }), (x))
+#define MAGIC_NUMBER(x) (({ FIXME("Replace magic number " #x " with constant") }), (x))
-/* Usage example: call this in some IBAction that you will implement later,
- * to generate a warning at compile time AND display an alert at runtime if the user trigger the IBAction
+/* Usage example:
+ * NOT_IMPLEMENTED("This should show the details in a separate screen")
+ *
+ * Call this in some IBAction that you will implement later, to generate a warning
+ * at compile time AND display an alert at runtime if the user trigger the IBAction
*/
-#define NOT_IMPLEMENTED(warningMessage...) [[[[UIAlertView alloc] initWithTitle:@"Not implemented" \
- message:[NSString stringWithFormat:@"%s",__PRETTY_FUNCTION__] \
+#define NOT_IMPLEMENTED(warningMessage) [[[[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s",__PRETTY_FUNCTION__] \
+ message:[NSString stringWithFormat:@"%s",warningMessage] \
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease] show]; \
- TODO(Implement this - warningMessage)
+ TODO("Implement this - " warningMessage)

0 comments on commit 8f38d30

Please sign in to comment.