summaryrefslogtreecommitdiff
path: root/tests/test-intprops.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-10-24 22:25:29 +0200
committerJörg Frings-Fürst <debian@jff.email>2022-10-24 22:25:29 +0200
commit26112352a774737e1ce5580c93654a26c1e82b39 (patch)
treed64e2f5b6e7aa92fa9a8ffb8ae5df75310532714 /tests/test-intprops.c
parentbe8efac78d067c138ad8dda03df4336e73f94887 (diff)
New upstream version 1.1upstream/1.1
Diffstat (limited to 'tests/test-intprops.c')
-rw-r--r--tests/test-intprops.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/test-intprops.c b/tests/test-intprops.c
index dd7e7d3f..a54d5812 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