]> Savannah Git Hosting - gnulib.git/commitdiff
stdckdint-h tests: Fix compilation error (regression 2025-02-07).
authorBruno Haible <bruno@clisp.org>
Sun, 9 Feb 2025 07:04:30 +0000 (08:04 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Feb 2025 07:04:30 +0000 (08:04 +0100)
* tests/test-intprops.c: Exclude INT_PROMOTE checks if TEST_STDCKDINT is
defined.

ChangeLog
tests/test-intprops.c

index 710db41aa860da3a00cab8ba5da796f4398fd193..73350f9f99cd87313cf50143d25df1e91fbb5e7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-02-09  Bruno Haible  <bruno@clisp.org>
+
+       stdckdint-h tests: Fix compilation error (regression 2025-02-07).
+       * tests/test-intprops.c: Exclude INT_PROMOTE checks if TEST_STDCKDINT is
+       defined.
+
 2025-02-09  Bruno Haible  <bruno@clisp.org>
 
        intprops tests: Strengthen INT_PROMOTE tests.
index 6c06e47ab34d70278a84d5c6274af1f14433cd88..d16b67b5cea4137f016055ea5ad205d8fc9841aa 100644 (file)
 
 #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__))
+# 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
+# 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;
@@ -84,9 +86,6 @@ main (void)
   /* Use VERIFY for tests that must be integer constant expressions,
      ASSERT otherwise.  */
 
-  /* Check that INT_PROMOTE is a no-op on floats.  */
-  ASSERT (INT_PROMOTE (2.71828) > 2);
-
 #ifndef TEST_STDCKDINT
   /* TYPE_IS_INTEGER.  */
   ASSERT (TYPE_IS_INTEGER (bool));
@@ -121,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);