Hi,

I think a CTASSERT macro like in FreeBSD would be nice. It could be used 
to verify assumptions about type and struct sizes.

This should work on gcc 2.9.5, too, but I haven't tested it.

--- sys/lib/libkern/libkern.h
+++ sys/lib/libkern/libkern.h
@@ -138,6 +138,9 @@ abs(int j)
 #endif
 #endif
 
+#define        CTASSERT(x)     extern char  _ctassert[(x) ? 1 : -1 ]   \
+                           __attribute__((__unused__))
+
 /* Prototypes for non-quad routines. */
 void    __assert(const char *, const char *, int, const char *)
            __attribute__ ((__noreturn__));

Reply via email to