From: Đoàn Trần Công Danh Date: Mon, 27 Apr 2020 14:22:35 +0000 (+0700) Subject: compat/regex: move stdlib.h up in inclusion chain X-Git-Tag: v2.27.0-rc0~53^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bc1f9e48cb9640c901d19f193f4417ca805a86a;p=thirdparty%2Fgit.git compat/regex: move stdlib.h up in inclusion chain In Linux with musl libc, we have this inclusion chain: compat/regex/regex.c:69 `-> compat/regex/regex_internal.h `-> /usr/include/stdlib.h `-> /usr/include/features.h `-> /usr/include/alloca.h In that inclusion chain, `` claims it's _BSD_SOURCE compatible when it's NOT asked to be either {_POSIX,_GNU,_XOPEN,_BSD}_SOURCE, or __STRICT_ANSI__. And, `` will include `` to be compatible with software written for GNU and BSD. Thus, redefine `alloca` macro, which was defined before at compat/regex/regex.c:66. Considering this is only compat code, we've taken from other project, it's not our business to decide which source should we adhere to. Include `` early to prevent the redefinition of alloca. This also remove a potential warning about alloca not defined on: #undef alloca Helped-by: Ramsay Jones Signed-off-by: Đoàn Trần Công Danh Signed-off-by: Junio C Hamano --- diff --git a/compat/regex/regex.c b/compat/regex/regex.c index f3e03a9eab..e6f4a5d177 100644 --- a/compat/regex/regex.c +++ b/compat/regex/regex.c @@ -60,6 +60,7 @@ #undefs RE_DUP_MAX and sets it to the right value. */ #include #include +#include #ifdef GAWK #undef alloca diff --git a/compat/regex/regex_internal.h b/compat/regex/regex_internal.h index 3ee8aae59d..0bad8b841e 100644 --- a/compat/regex/regex_internal.h +++ b/compat/regex/regex_internal.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC