buffers: major cleanup and improvements
[vpp.git] / src / vppinfra / error_bootstrap.h
index 248d389..18d2176 100644 (file)
@@ -91,6 +91,10 @@ do {                                                 \
 #define STATIC_ASSERT_OFFSET_OF(s, e, o) \
   STATIC_ASSERT (STRUCT_OFFSET_OF(s,e) == o, "Offset of " #s "." #e " must be " # o)
 
+#define STATIC_ASSERT_FITS_IN(s, e, o) \
+  STATIC_ASSERT (STRUCT_OFFSET_OF(s,e) <= (o - sizeof(((s *)0)->e)), \
+  #s "." #e " does not fit into " # o " bytes")
+
 /* Assert without allocating memory. */
 #define ASSERT_AND_PANIC(truth)                        \
 do {                                           \