Skip to content

Commit 62cb552

Browse files
dschoGit for Windows Build Agent
authored andcommitted
build: tolerate use of _Generic from glibc 2.43 with Clang (#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 e6ec201 + e2ff54b commit 62cb552

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

config.mak.dev

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ endif
2121
endif
2222

2323
ifneq ($(uname_S),FreeBSD)
24-
ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang7,$(COMPILER_FEATURES))),)
24+
ifneq ($(filter gcc6,$(COMPILER_FEATURES)),)
2525
ifndef USE_MIMALLOC
2626
DEVELOPER_CFLAGS += -std=gnu99
2727
endif
2828
endif
2929
else
3030
# FreeBSD cannot limit to C99 because its system headers unconditionally
3131
# rely on C11 features.
32+
#
33+
# Clang cannot limit to C99 when using glibc 2.43 because its system headers
34+
# depend on the _Generic C11 feature. This works with GCC though.
3235
endif
3336

3437
DEVELOPER_CFLAGS += -Wdeclaration-after-statement

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)