ofp-msgs: Split OFPRAW_OFPST_AGGREGATE_REQUEST
[openvswitch] / lib / util.h
index 60ec737e2ad9580c9214a4b94aec303571682ceb..57527fcc686edbfcedcf5149ecf369a69e123758 100644 (file)
 #define BUILD_ASSERT_DECL_GCCONLY(EXPR) ((void) 0)
 #endif
 
+/* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes
+ * anything other than an outermost "const" or "volatile" qualifier.
+ *
+ * The cast to int is present only to suppress an "expression using sizeof
+ * bool" warning from "sparse" (see
+ * http://permalink.gmane.org/gmane.comp.parsers.sparse/2967). */
+#define CONST_CAST(TYPE, POINTER)                               \
+    ((void) sizeof ((int) ((POINTER) == (TYPE) (POINTER))),     \
+     (TYPE) (POINTER))
+
 extern const char *program_name;
 extern const char *subprogram_name;