summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-07-04 14:47:42 +0000
committerJim Meyering <jim@meyering.net>2005-07-04 14:47:42 +0000
commit13bda3c7c6160412e880c2c822a9d380ea8985a1 (patch)
treecc4927abb48a290899edf8dfb7c522016407ca66 /lib
parent87371803becc91a459ba36eef89a4760aacc70a3 (diff)
downloadcoreutils-13bda3c7c6160412e880c2c822a9d380ea8985a1.tar.xz
(verify_dcl): Rename from VERIFY. Update use.
Diffstat (limited to 'lib')
-rw-r--r--lib/argmatch.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/argmatch.h b/lib/argmatch.h
index 45bfa03a7..cb7e39cdf 100644
--- a/lib/argmatch.h
+++ b/lib/argmatch.h
@@ -25,13 +25,17 @@
# include <stddef.h>
-# ifndef VERIFY
+# ifndef verify_dcl
# define GL_CONCAT0(x, y) x##y
# define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
-/* Verify a requirement at compile-time (unlike assert, which is runtime). */
-# define VERIFY(assertion) \
- struct GL_CONCAT (compile_time_assert_, __LINE__) \
- { char a[(assertion) ? 1 : -1]; }
+
+/* Verify requirement, R, at compile-time, as a declaration.
+ The implementation uses a struct declaration whose name includes the
+ expansion of __LINE__, so there is a small chance that two uses of
+ verify_dcl from different files will end up colliding (for example,
+ f.c includes f.h and verify_dcl is used on the same line in each). */
+# define verify_dcl(R) \
+ struct GL_CONCAT (ct_assert_, __LINE__) { char a[(R) ? 1 : -1]; }
# endif
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
@@ -45,7 +49,7 @@
ARGMATCH_ASSERT is for backward compatibility only. */
# define ARGMATCH_VERIFY(Arglist, Vallist) \
- VERIFY (ARGMATCH_CONSTRAINT (Arglist, Vallist))
+ verify_dcl (ARGMATCH_CONSTRAINT (Arglist, Vallist))
# define ARGMATCH_ASSERT(Arglist, Vallist) \
assert (ARGMATCH_CONSTRAINT (Arglist, Vallist))