From: Paul Eggert Date: Sun, 12 May 2024 05:30:50 +0000 (-0700) Subject: stdbit: don’t assume -DHAVE_CONFIG_H X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=4312df511a7488992d51739654f1fa07492de88f;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 6154ef2bc8..3e5df0d22d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2024-05-11 Paul Eggert + + 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 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 #endif #include #include -#if !HAVE_CONFIG_H +#if !GNULIB_TEST_STDBIT # include # include #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__) \