Переглянути джерело

misc/debug.h: add B_USE for suppressing warnings about uninitialized variables

ambrop7 13 роки тому
батько
коміт
e0876b0af6
1 змінених файлів з 10 додано та 0 видалено
  1. 10 0
      misc/debug.h

+ 10 - 0
misc/debug.h

@@ -78,6 +78,14 @@
  * Insert at the end of the declaration of a function before the semicolon.
  */
 
+/**
+ * @def B_USE
+ * 
+ * This can be used to suppress warnings about unused variables. It can
+ * be applied to a variable or any expression. It does not evaluate the
+ * expression.
+ */
+
 #ifndef BADVPN_MISC_DEBUG_H
 #define BADVPN_MISC_DEBUG_H
 
@@ -127,4 +135,6 @@
     #define WARN_UNUSED
 #endif
 
+#define B_USE(expr) (void)(sizeof((expr)));
+
 #endif