1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-30 05:47:53 +01:00
git/compat/regex
Đoàn Trần Công Danh 3bc1f9e48c 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, `<features.h>` claims it's _BSD_SOURCE
compatible when it's NOT asked to be either
{_POSIX,_GNU,_XOPEN,_BSD}_SOURCE, or __STRICT_ANSI__.
And, `<stdlib.h>` will include `<alloca.h>` 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 `<stdlib.h>` early to prevent the redefinition of alloca.
This also remove a potential warning about alloca not defined on:
	#undef alloca

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-04-27 11:21:16 -07:00
..
regcomp.c Fix spelling errors in no-longer-updated-from-upstream modules 2019-11-10 16:00:55 +09:00
regex.c compat/regex: move stdlib.h up in inclusion chain 2020-04-27 11:21:16 -07:00
regex.h Merge branch 'jk/asan-build-fix' 2020-01-30 14:17:09 -08:00
regex_internal.c Fix spelling errors in no-longer-updated-from-upstream modules 2019-11-10 16:00:55 +09:00
regex_internal.h compat/regex: move stdlib.h up in inclusion chain 2020-04-27 11:21:16 -07:00
regexec.c Fix spelling errors in no-longer-updated-from-upstream modules 2019-11-10 16:00:55 +09:00