Przeglądaj źródła

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

ambrop7 13 lat temu
rodzic
commit
e0876b0af6
1 zmienionych plików z 10 dodań i 0 usunięć
  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.
  * 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
 #ifndef BADVPN_MISC_DEBUG_H
 #define BADVPN_MISC_DEBUG_H
 #define BADVPN_MISC_DEBUG_H
 
 
@@ -127,4 +135,6 @@
     #define WARN_UNUSED
     #define WARN_UNUSED
 #endif
 #endif
 
 
+#define B_USE(expr) (void)(sizeof((expr)));
+
 #endif
 #endif