From 13bda3c7c6160412e880c2c822a9d380ea8985a1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 4 Jul 2005 14:47:42 +0000 Subject: (verify_dcl): Rename from VERIFY. Update use. --- lib/argmatch.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/argmatch.h') 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 -# 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)) -- cgit v1.2.3-54-g00ecf