git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] config.mak.dev: suppress C11 extension warning for Clang on Linux

From
SGShardul Natu via GitGitGadget <gitgitgadget@gmail.com>
Date
May 7, 2026, 02:16 UTC
Message-ID
<pull.2291.git.git.1778120192298.gitgitgadget@gmail.com>
From: Shnatu <snatu@google.com>

When building Git with Clang on Linux with DEVELOPER=1, the build fails because Clang treats C11 features used in glibc headers as extensions and raises errors due to -std=gnu99, -pedantic, and -Werror.

Specifically, glibc's string.h uses _Generic (a C11 feature) in macros like strchr. When these macros are expanded in Git's C files, Clang warns about them being C11 extensions.

GCC does not exhibit this behavior because it suppresses pedantic warnings for macros defined in system headers.

To fix this, add -Wno-c11-extensions to DEVELOPER_CFLAGS when using Clang, but restrict it to Linux (uname_S == Linux). This suppresses the warning for glibc headers while keeping the build strict on other platforms (like macOS) to catch accidental C11 usage in Git's own code.

Signed-off-by: Shnatu <snatu@google.com>
---
    config.mak.dev: suppress C11 extension warning for Clang on Linux
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2291%2Fkiranani%2Fnext-2-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2291/kiranani/next-2-v1
Pull-Request: https://github.com/git/git/pull/2291
 config.mak.dev | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/config.mak.dev b/config.mak.dev
index c8dcf78779..f1dcf4329a 100644
--- a/config.mak.dev
+++ b/config.mak.dev
@@ -87,6 +87,9 @@ endif
 # The bug was fixed in Apple clang 12.
 #
 ifneq ($(filter clang1,$(COMPILER_FEATURES)),)     # if we are using clang
+ifeq ($(uname_S),Linux)
+DEVELOPER_CFLAGS += -Wno-c11-extensions
+endif
 ifeq ($(uname_S),Darwin)                           # if we are on darwin
 ifeq ($(filter clang12,$(COMPILER_FEATURES)),)     # if version < 12
 DEVELOPER_CFLAGS += -Wno-missing-braces

base-commit: 4f69b47b940100b02630f745a52f9d9850f122b2
-- 
gitgitgadget
Next: Pablo
Message 1 of 3 in “config.mak.dev: suppress C11 extension warning for Clang on Linux”
  1. config.mak.dev: suppress C11 extension warning for Clang on LinuxShardul Natu via GitGitGadget, May 7, 2026
  2. PabloMay 7, 2026
  3. Junio C HamanoMay 10, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.