aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2024-07-17 06:17:41 +0700
committerJunio C Hamano <gitster@pobox.com>2025-04-09 08:42:59 -0700
commitda87b58014c1673ed8c47a14d315ad5ad4d801db (patch)
treeb3dec8c59a88308fc5db31fc1702a923f8f1e368
parent683c54c999c301c2cd6f715c411407c413b1d84e (diff)
downloadgit-da87b58014c1673ed8c47a14d315ad5ad4d801db.tar.gz
sparse: ignore warning from new glibc headers
With at least glibc 2.39, glibc provides a function declaration that matches with this POSIX interface: int regexec(const regex_t *restrict preg, const char *restrict string, size_t nmatch, regmatch_t pmatch[restrict], int eflags); such prototype requires variable-length-array for `pmatch'. Thus, sparse reports this error: > ../add-patch.c: note: in included file (through ../git-compat-util.h): > /usr/include/regex.h:682:41: error: undefined identifier '__nmatch' > /usr/include/regex.h:682:41: error: bad constant expression type > /usr/include/regex.h:682:41: error: Variable length array is used. Note: `__nmatch' is POSIX's nmatch. The glibc's intention is informing their users to provides a large enough buffer to hold `__nmatch' results and provides diagnosis if necessary. It's merely a glibc' implementation detail. Hide that usage from sparse by using standard C11's macro: __STDC_NO_VLA__ Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 7315507381..3868edd349 100644
--- a/Makefile
+++ b/Makefile
@@ -1409,7 +1409,7 @@ ARFLAGS = rcs
PTHREAD_CFLAGS =
# For the 'sparse' target
-SPARSE_FLAGS ?= -std=gnu99
+SPARSE_FLAGS ?= -std=gnu99 -D__STDC_NO_VLA__
SP_EXTRA_FLAGS =
# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak,address targets