diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
| commit | cfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch) | |
| tree | 8016486f8ee7157213f2d09ff2491bfa9c94638a /tests/test-intprops.c | |
| parent | 14e4d584d0121031ec40e6c35869745f1747ff29 (diff) | |
| parent | 1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff) | |
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'tests/test-intprops.c')
| -rw-r--r-- | tests/test-intprops.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/test-intprops.c b/tests/test-intprops.c index 3bffc3f5..8cbc8f9c 100644 --- a/tests/test-intprops.c +++ b/tests/test-intprops.c @@ -1,5 +1,5 @@ /* Test intprops.h. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. 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 @@ -26,7 +26,7 @@ # pragma GCC diagnostic ignored "-Wtype-limits" /* Work around a bug in GCC 6.1 and earlier; see: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971 */ + https://gcc.gnu.org/PR68971 */ # pragma GCC diagnostic ignored "-Woverflow" #endif @@ -62,6 +62,21 @@ #define DONTCARE __LINE__ +#ifndef TEST_STDCKDINT +/* Check that INT_PROMOTE promotes to int. + GCC < 4.9 lacks _Generic even though it may claim C11 conformance. */ +# if (201112 <= __STDC_VERSION__ \ + && (!defined __GNUC__ || 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \ + || defined __clang__)) +int check_INT_PROMOTE = _Generic (INT_PROMOTE ((short int) 0), int: 0); +# endif +/* For other compilers, check the size and sign of INT_PROMOTE (x). */ +int check_INT_PROMOTE_size + [2 * (sizeof (INT_PROMOTE ((short int) 0)) == sizeof (int)) - 1]; +int check_INT_PROMOTE_sign + [2 * (INT_PROMOTE ((short int) -1) < 0) - 1]; +#endif + int int_minus_2 = -2; int int_1 = 1; @@ -105,6 +120,9 @@ main (void) ASSERT (TYPE_SIGNED (double)); ASSERT (TYPE_SIGNED (long double)); + /* Check that INT_PROMOTE is a no-op on floats. */ + ASSERT (INT_PROMOTE (2.71828) > 2); + /* Integer representation. Check that it is two's complement. */ VERIFY (INT_MIN + INT_MAX < 0); |
