projects
/
platform
/
upstream
/
nasm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
638c1ac
)
nasmlib.h: Introduce nasm_build_assert
author
Cyrill Gorcunov
<gorcunov@gmail.com>
Thu, 5 Nov 2009 20:35:04 +0000
(23:35 +0300)
committer
Cyrill 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
patch
|
blob
|
history
diff --git
a/nasmlib.h
b/nasmlib.h
index 9d39117c23eea6c2f1cf6f1aea18b5b1a1d6e3a5..260010973bf61e52f004b8b1fd15ac464e6a6095 100644
(file)
--- a/
nasmlib.h
+++ b/
nasmlib.h
@@
-172,6
+172,11
@@
no_return nasm_assert_failed(const char *, int, const char *);
nasm_assert_failed(__FILE__,__LINE__,#x); \
} 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'.