]> Savannah Git Hosting - gnulib.git/commitdiff
stdbit: don’t assume -DHAVE_CONFIG_H
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 12 May 2024 05:30:50 +0000 (22:30 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 12 May 2024 05:31:19 +0000 (22:31 -0700)
This is needed for diffutils, which doesn’t define HAVE_CONFIG_H.
There needs to be some way for a test shared with glibc to discover
whether it should use the Gnulib or the glibc testing framework,
and I guess this is it.
* modules/stdbit-tests (GNULIB_TEST_STDBIT): Define.
* tests/tst-stdbit.h: Use GNULIB_TEST_STDBIT, not HAVE_CONFIG_H.

ChangeLog
modules/stdbit-tests
tests/tst-stdbit.h

index 6154ef2bc87c86e7e363563781b631f4e92331ba..3e5df0d22d8dc68017f544d274e0d027d70f754b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-05-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdbit: don’t assume -DHAVE_CONFIG_H
+       This is needed for diffutils, which doesn’t define HAVE_CONFIG_H.
+       There needs to be some way for a test shared with glibc to discover
+       whether it should use the Gnulib or the glibc testing framework,
+       and I guess this is it.
+       * modules/stdbit-tests (GNULIB_TEST_STDBIT): Define.
+       * tests/tst-stdbit.h: Use GNULIB_TEST_STDBIT, not HAVE_CONFIG_H.
+
 2024-05-11  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Filter out dependencies that cannot be found.
index 4ef358aca91b797e06f02a310ceb9523a73ba129..a5832c84f21a4e7feaa6606ffe7ddda5f3d2001a 100644 (file)
@@ -23,6 +23,8 @@ libc-config
 stdint
 
 configure.ac:
+AC_DEFINE([GNULIB_TEST_STDBIT], [1],
+  [Define to 1 so that stdbit tests use the Gnulib framework, not glibc's.])
 
 Makefile.am:
 TESTS += \
index b40d7447bfeb9bcd3f41cf6a3003c1a265436fa1..0a0ab6b66cd2dbbef18acdc36256211196bd0fc0 100644 (file)
 #ifndef _TST_STDBIT_H
 #define _TST_STDBIT_H
 
-#if HAVE_CONFIG_H
+#if GNULIB_TEST_STDBIT
 # include <libc-config.h>
 #endif
 
 #include <stdbit.h>
 #include <stdbool.h>
 
-#if !HAVE_CONFIG_H
+#if !GNULIB_TEST_STDBIT
 # include <array_length.h>
 # include <support/check.h>
 #else
@@ -46,7 +46,7 @@ struct stdbit_test
   uint64_t res_8, res_16, res_32, res_64;
 };
 
-#if !HAVE_CONFIG_H
+#if !GNULIB_TEST_STDBIT
 # define TEST_TYPE(EXPR, TYPE)                                         \
   _Static_assert (_Generic ((EXPR), TYPE: 1, default: 0), "bad type")
 #elif ((defined __GNUC__ && 2 <= __GNUC__) \