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 | 10 ++++++++++ modules/stdbit-tests | 2 ++ tests/tst-stdbit.h | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 6154ef2bc8..3e5df0d22d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2024-05-11 Paul Eggert <egg...@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.fu...@gmail.com> gnulib-tool.py: Filter out dependencies that cannot be found. diff --git a/modules/stdbit-tests b/modules/stdbit-tests index 4ef358aca9..a5832c84f2 100644 --- a/modules/stdbit-tests +++ b/modules/stdbit-tests @@ -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 += \ diff --git a/tests/tst-stdbit.h b/tests/tst-stdbit.h index b40d7447bf..0a0ab6b66c 100644 --- a/tests/tst-stdbit.h +++ b/tests/tst-stdbit.h @@ -19,14 +19,14 @@ #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__) \ -- 2.40.1