summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-06-29 16:23:15 +0000
committerJim Meyering <jim@meyering.net>2005-06-29 16:23:15 +0000
commit87f543aea5b9c0a70c687adfa84a43595ef14a77 (patch)
treef4bc0c32788299af78eb549e76daa2f473cac122 /src/system.h
parente4d87dd57336d27566c5e433b291dd4a09297dbe (diff)
downloadcoreutils-87f543aea5b9c0a70c687adfa84a43595ef14a77.tar.xz
(VERIFY): Rewrite to use string-concatenation
and __LINE__ so as not to require a struct name parameter. (GL_CONCAT, GL_CONCAT2, GL_LINE_CONCAT): Define helper macros.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/system.h b/src/system.h
index 0ffc8a589..79d6dbb39 100644
--- a/src/system.h
+++ b/src/system.h
@@ -812,8 +812,12 @@ ptr_align (void const *ptr, size_t alignment)
return (void *) (p1 - (size_t) p1 % alignment);
}
+#define GL_CONCAT(x,y) x##y
+#define GL_CONCAT2(x,y) GL_CONCAT(x,y)
+#define GL_LINE_CONCAT(x) GL_CONCAT2(x, __LINE__)
/* Verify a requirement at compile-time (unlike assert, which is runtime). */
-#define VERIFY(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
+#define VERIFY(assertion) \
+ struct GL_LINE_CONCAT(compile_time_assert) { char a[(assertion) ? 1 : -1]; }
/* Like the above, but use an expression rather than a struct declaration.
This macro may be used in some contexts where the other may not. */