Hello, Andrew Hamilton wrote: > While doing this, I've encountered a scenario where I get a compile > error like the following: > In file included from video/emu/sdl.c:21: > ../config-util.h:2748:6: error: "__clang_major__" is not defined, > evaluates to 0 [-Werror=undef]
To be precise, you got a warning from the compiler. Turning the warning into an error was _your_ choice, via '-Werror'. > diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 > index 719c627..d4c3624 100644 > --- a/m4/gnulib-common.m4 > +++ b/m4/gnulib-common.m4 > @@ -911,7 +911,7 @@ AC_DEFUN([gl_COMMON_BODY], [ > -Wthread-safety is enabled. For usage, see > <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */ > #ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE > -# if __clang_major__ >= 15 > +# if defined __clang__ && __clang_major__ >= 15 > # define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \ > __attribute__ ((__capability__ (concept))) > # else The patch that you propose is not wrong, but it would fix only the first occurrence of the '-Wundef' warning. Surely there will be other ones later (that you would see by not using '-Werror'). Gnulib does not care about -Wundef warnings, because eliminating all of them would require many changes, that are just code verbosity: it would make reading and maintaining the code harder, without real benefit. So, my recommendation is: 1. Get rid of '-Werror'. 2. After running a build, analyze the warnings through the attached script. This also will help you judge which warning options are useful and which are not. Bruno
warnings-by-category
Description: application/shellscript
