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:44 +0200
committerJörg Frings-Fürst <debian@jff.email>2022-10-24 22:25:44 +0200
commitcb4186bef1b44691db4221406d001a8d40c65b4b (patch)
tree285662381eaa0514f988142bff0c8a9685c84dc0 /tests/test-intprops.c
parentcc0876a2fa9e703b1064992ab535f3eed57e9c71 (diff)
parent26112352a774737e1ce5580c93654a26c1e82b39 (diff)
Update upstream source from tag 'upstream/1.1'
Update to upstream version '1.1' with Debian dir acc8a9214de592a0bbbdb680385559210b329d52
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 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