From 26112352a774737e1ce5580c93654a26c1e82b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 24 Oct 2022 22:25:29 +0200 Subject: New upstream version 1.1 --- tests/test-intprops.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'tests/test-intprops.c') 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 -#include "intprops.h" -#include "verify.h" +#ifdef TEST_STDCKDINT +# include +#else +# include "intprops.h" +#endif -#include #include #include @@ -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 . */ -#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__RANGE_OVERFLOW tests are equally valid as INT__OVERFLOW tests, so define macros to do both. OP is the -- cgit v1.2.3