Thanks for the fix, Adhemerval Zanella. I assume you would fix this in other files too, for example I think a similar patch is needed for posix/fnmatch.c.
fnmatch.c:67:26: error: "__clang_major__" is not defined [-Werror=undef] # if (__GNUC__ >= 7) || (__clang_major__ >= 10) ^~~~~~~~~~~~~~~ On 20/01/2021, 11:27, "Adhemerval Zanella" <adhemerval.zane...@linaro.org> wrote: On 19/01/2021 23:55, Paul Eggert wrote: > On 1/19/21 7:43 AM, Bruno Haible wrote: >> Adhemerval Zanella wrote: >>> -# if (__GNUC__ >= 7) || (__clang_major__ >= 10) >>> +# if (__GNUC__ >= 7) || (defined __clang_major__ &&__clang_major__ >= 10) >> I would write it as: >> >> +# if (__GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10) > > This line should be used only if _LIBC is defined, so we can simplify it to just "#if __GNUC__ >= 7" and thus not worry about Clang. > > I see that Gnulib wasn't consistent about this, so I installed the attached patch to Gnulib to fix the issue here and elsewhere. The idea is that the Gnulib regex_internal.h can be copied back to glibc, and that the other uses in Gnulib should be similar. Thanks, I will check with a bootstrap build and sync regex_internal.h with glibc. > > On 1/19/21 6:43 AM, Adhemerval Zanella wrote: > >> Paul, this seemed to a common pattern scatter on multiple file in gnulib. >> Wouldn't be better to consolidate it on cdefs.h? > > We could append something like the following to cdefs.h, and switch to __attribute_fallthrough__ for modules shared between the two systems. Is that something you'd like to pursue? (We should also sync Gnulib cdefs.h back to glibc of course.) > > #if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__ > # define __attribute_fallthrough__ [[__fallthrough__]] > #elif __GNUC_PREREQ (7, 0) || __glibc_has_attribute (__fallthrough__) > # define __attribute_fallthrough__ __attribute__ ((__fallthrough__)) > #else > # define __attribute_fallthrough__ ((void) 0) > #endif Yes, for 2.34 I will send some patches to sync the remaining gnulib files and document from our part the shared files.