Skip to content

Commit 6fa2b2f

Browse files
committed
build: tolerate use of _Generic from glibc 2.43 with Clang (git-for-windows#6233)
The `linux-{asan-ubsan,sha256,reftable}` jobs run inside `ubuntu:rolling`, which now resolves to Ubuntu 26.04 with glibc 2.43; that pulls `_Generic` into `<sys/cdefs.h>` and breaks our `-std=gnu99 -Werror` Clang builds. Concrete failure: https://github.com/git-for-windows/git/actions/runs/25390480083/job/74463338845. Picking up Patrick Steinhardt's fix from https://lore.kernel.org/git/20260505-b4-pks-ci-tolerate-glibc-generic-v1-1-5786386fe512@pks.im/ ahead of its upstream merge so the GfW CI goes green again. The diff conflicts with `fe5704a3695c "mimalloc: offer a build-time option to enable it"`, which wraps the affected `config.mak.dev` block in `ifndef USE_MIMALLOC`; the resolution preserves that wrap on the `gcc6`-only branch surviving Patrick's patch. `meson.build` auto-merged.
2 parents 67170af + c6daaad commit 6fa2b2f

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

config.mak.dev

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ endif
9898
endif
9999
endif
100100

101+
# glibc 2.43 headers unconditionally use _Generic even when we ask the
102+
# compiler to stick to -std=gnu99 and unlike GCC, clang lacks a
103+
# workaround to squelch warnings from system headers.
104+
ifneq ($(filter clang1,$(COMPILER_FEATURES)),) # if we are using clang
105+
DEVELOPER_CFLAGS += -Wno-c11-extensions
106+
endif
107+
101108
# https://bugzilla.redhat.com/show_bug.cgi?id=2075786
102109
ifneq ($(filter gcc12,$(COMPILER_FEATURES)),)
103110
DEVELOPER_CFLAGS += -Wno-error=stringop-overread

meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,12 @@ if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argum
867867
libgit_c_args += cflag
868868
endif
869869
endforeach
870+
871+
# Clang generates warnings when compiling glibc 2.43 because of the use of
872+
# _Generic.
873+
if compiler.get_id() == 'clang'
874+
libgit_c_args += '-Wno-c11-extensions'
875+
endif
870876
endif
871877

872878
if get_option('breaking_changes')

0 commit comments

Comments
 (0)