diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-12-08 17:35:13 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-12-08 17:35:13 +0100 |
commit | 1b1ad4ed2919fbc68d8905cfec38a968821ce372 (patch) | |
tree | 5532a7e21342f88f4df7cd42139e012b6bd1dbe6 /tests/test-intprops.c | |
parent | 63b5c0db2dc641876e58d232220c7efc2b2c2423 (diff) | |
parent | fa82e850f8d894ae4b9cd75bd12ffeeb65974d50 (diff) |
Merge branch 'release/debian/1.1-1_experimental1'debian/1.1-1_experimental1
Diffstat (limited to 'tests/test-intprops.c')
-rw-r--r-- | tests/test-intprops.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/test-intprops.c b/tests/test-intprops.c index dd7e7d3..a54d581 100644 --- a/tests/test-intprops.c +++ b/tests/test-intprops.c @@ -3,7 +3,7 @@ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -30,10 +30,12 @@ #include <config.h> -#include "intprops.h" -#include "verify.h" +#ifdef TEST_STDCKDINT +# include <stdckdint.h> +#else +# include "intprops.h" +#endif -#include <stdbool.h> #include <inttypes.h> #include <limits.h> @@ -41,14 +43,17 @@ /* Compile-time verification of expression X. In this file, we need it as a statement, rather than as a declaration. */ -#define verify_stmt(x) do { verify (x); } while (0) +#define verify_stmt(x) do { static_assert (x); } while (0) /* VERIFY (X) uses a static assertion for compilers that are known to work, and falls back on a dynamic assertion for other compilers. + But it ignores X if testing stdckdint.h. These tests should be checkable via 'verify' rather than 'ASSERT', but using 'verify' would run into a bug with HP-UX 11.23 cc; see <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>. */ -#if __GNUC__ || __clang__ || __SUNPRO_C +#ifdef TEST_STDCKDINT +# define VERIFY(x) ((void) 0) +#elif __GNUC__ || __clang__ || __SUNPRO_C # define VERIFY(x) verify_stmt (x) #else # define VERIFY(x) ASSERT (x) @@ -65,6 +70,7 @@ main (void) /* Use VERIFY for tests that must be integer constant expressions, ASSERT otherwise. */ +#ifndef TEST_STDCKDINT /* TYPE_IS_INTEGER. */ ASSERT (TYPE_IS_INTEGER (bool)); ASSERT (TYPE_IS_INTEGER (char)); @@ -161,6 +167,7 @@ main (void) VERIFY (INT_STRLEN_BOUND (int64_t) == sizeof ("-9223372036854775808") - 1); VERIFY (INT_BUFSIZE_BOUND (int64_t) == sizeof ("-9223372036854775808")); #endif +#endif /* All the INT_<op>_RANGE_OVERFLOW tests are equally valid as INT_<op>_OVERFLOW tests, so define macros to do both. OP is the |