summaryrefslogtreecommitdiff
path: root/lib/argmatch.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-09-22 06:39:14 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-09-22 06:39:14 +0000
commit75b92233d8cbac53eb0de4fd7b198a9caa988526 (patch)
tree6675e237d80e03b9a09889d18c72d99de2a5d9d0 /lib/argmatch.h
parent99eda9943e4879b069959ddad65dfb832727f9a6 (diff)
downloadcoreutils-75b92233d8cbac53eb0de4fd7b198a9caa988526.tar.xz
(GL_CONCAT): Remove.
Include "verify.h" instead. (ARGMATCH_CONSTRAINT, ARGMATCH_ASSERT): Remove. (ARGMATCH_VERIFY): Rewrite in terms of new verify macros.
Diffstat (limited to 'lib/argmatch.h')
-rw-r--r--lib/argmatch.h25
1 files changed, 3 insertions, 22 deletions
diff --git a/lib/argmatch.h b/lib/argmatch.h
index cb7e39cdf..f2dfe59bd 100644
--- a/lib/argmatch.h
+++ b/lib/argmatch.h
@@ -25,34 +25,15 @@
# include <stddef.h>
-# ifndef verify_dcl
-# define GL_CONCAT0(x, y) x##y
-# define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
-
-/* 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
+# include "verify.h"
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
-# define ARGMATCH_CONSTRAINT(Arglist, Vallist) \
- (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)
-
/* Assert there are as many real arguments as there are values
- (argument list ends with a NULL guard). ARGMATCH_VERIFY is
- preferred, since it is guaranteed to be checked at compile-time.
- ARGMATCH_ASSERT is for backward compatibility only. */
+ (argument list ends with a NULL guard). */
# define ARGMATCH_VERIFY(Arglist, Vallist) \
- verify_dcl (ARGMATCH_CONSTRAINT (Arglist, Vallist))
-
-# define ARGMATCH_ASSERT(Arglist, Vallist) \
- assert (ARGMATCH_CONSTRAINT (Arglist, Vallist))
+ verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)
/* Return the index of the element of ARGLIST (NULL terminated) that
matches with ARG. If VALLIST is not NULL, then use it to resolve