diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Pin the sources to gnu17
-rw-r--r--source/cgit.mk11
1 file changed, 11 insertions, 0 deletions
diff --git a/source/cgit.mk b/source/cgit.mk
index 3234148..e0a3312 100644
--- a/source/cgit.mk
+++ b/source/cgit.mk
@@ -35,8 +35,19 @@ $(CGIT_BUILD)/VERSION: force-version
-include $(CGIT_BUILD)/VERSION
.PHONY: force-version
+# The language the cgit sources are written in. Both GCC and Clang default to
+# this today, so pinning it changes nothing now and stops the meaning of the
+# sources drifting when a compiler moves its default on (GCC 15 defaults to
+# gnu23). The GNU dialect rather than plain c17 because git's headers use GNU
+# extensions, and because dlsym cannot be used through a conforming cast.
+#
+# Only the cgit objects are held to this. Git keeps whatever its own build
+# decides, which on some platforms is a different standard again.
+CGIT_STD ?= gnu17
+
# CGIT_CFLAGS is tracked separately so that changing it does not force a
# rebuild of Git itself.
+CGIT_CFLAGS += -std=$(CGIT_STD)
CGIT_CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
CGIT_CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
CGIT_CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'