nasmlib.h: Introduce nasm_build_assert
authorCyrill Gorcunov <gorcunov@gmail.com>
Thu, 5 Nov 2009 20:35:04 +0000 (23:35 +0300)
committerCyrill Gorcunov <gorcunov@gmail.com>
Thu, 5 Nov 2009 20:35:04 +0000 (23:35 +0300)
It's useful to protect our self from some
errors at build time.

For this sake we should use nasm_build_assert
if needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
nasmlib.h

index 9d39117..2600109 100644 (file)
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -173,6 +173,11 @@ no_return nasm_assert_failed(const char *, int, const char *);
     } while (0)
 
 /*
+ * NASM failure at build time if x != 0
+ */
+#define nasm_build_assert(x) (void)(sizeof(char[1-2*!!(x)]))
+
+/*
  * ANSI doesn't guarantee the presence of `stricmp' or
  * `strcasecmp'.
  */