Merge branch 'ps/clang-w-glibc-2.43-and-_Generic'

Headers from glibc 2.43 when used with clang does not allow
disabling C11 language features, causing build failures..

* ps/clang-w-glibc-2.43-and-_Generic:
  build: tolerate use of _Generic from glibc 2.43 with Clang
main
Junio C Hamano 2026-05-13 10:57:55 +09:00
commit 59ff4886a5
2 changed files with 13 additions and 0 deletions

View File

@ -98,6 +98,13 @@ endif
endif endif
endif endif


# glibc 2.43 headers unconditionally use _Generic even when we ask the
# compiler to stick to -std=gnu99 and unlike GCC, clang lacks a
# workaround to squelch warnings from system headers.
ifneq ($(filter clang1,$(COMPILER_FEATURES)),) # if we are using clang
DEVELOPER_CFLAGS += -Wno-c11-extensions
endif

# https://bugzilla.redhat.com/show_bug.cgi?id=2075786 # https://bugzilla.redhat.com/show_bug.cgi?id=2075786
ifneq ($(filter gcc12,$(COMPILER_FEATURES)),) ifneq ($(filter gcc12,$(COMPILER_FEATURES)),)
DEVELOPER_CFLAGS += -Wno-error=stringop-overread DEVELOPER_CFLAGS += -Wno-error=stringop-overread

View File

@ -866,6 +866,12 @@ if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argum
libgit_c_args += cflag libgit_c_args += cflag
endif endif
endforeach endforeach

# Clang generates warnings when compiling glibc 2.43 because of the use of
# _Generic.
if compiler.get_id() == 'clang'
libgit_c_args += '-Wno-c11-extensions'
endif
endif endif


if get_option('breaking_changes') if get_option('breaking_changes')