aboutsummaryrefslogtreecommitdiffstats
path: root/main/fortify-headers
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-07-14 16:49:07 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2016-07-14 16:50:39 +0200
commitff1bd55ec999566ce1667a23ab0c6784da050adb (patch)
tree0480955192cd8b4e396a0af2a55a3d030fed391d /main/fortify-headers
parent71904131ec77d7c05135d4cd7f42935b90957df8 (diff)
downloadaports-ff1bd55ec999566ce1667a23ab0c6784da050adb.tar.bz2
aports-ff1bd55ec999566ce1667a23ab0c6784da050adb.tar.xz
main/fortify-headers: oncly include limits.h when needed
this solves an issue with gcc and __extension__. ref #5899
Diffstat (limited to 'main/fortify-headers')
-rw-r--r--main/fortify-headers/0001-Only-include-limits.h-when-actually-used.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/main/fortify-headers/0001-Only-include-limits.h-when-actually-used.patch b/main/fortify-headers/0001-Only-include-limits.h-when-actually-used.patch
new file mode 100644
index 0000000000..2093e98a33
--- /dev/null
+++ b/main/fortify-headers/0001-Only-include-limits.h-when-actually-used.patch
@@ -0,0 +1,43 @@
+From a1445561442c19f2354b31ea4ac0084d2bd3b34f Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 14 Jul 2016 16:33:29 +0200
+Subject: [PATCH] Only include limits.h when actually used
+
+The __extension__ seems to trigger a bug in gcc when there are no
+identifier specified afterwards.
+
+Testcase:
+ echo "#include <stdlib.h>" > try.c && cc -O0 -c try.c
+ try.c:2:0: error: expected identifier or '(' at end of input
+
+With -O2 it does not happen.
+
+We work around this by only pulling in limits.h when we actually need the
+PATH_MAX.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ include/stdlib.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/stdlib.h b/include/stdlib.h
+index 26c7e44..0717e81 100644
+--- a/include/stdlib.h
++++ b/include/stdlib.h
+@@ -19,12 +19,12 @@
+ __extension__
+ #include_next <stdlib.h>
+
++#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+ #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ __extension__
+ #include_next <limits.h>
+ #endif
+
+-#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+ #include "fortify-headers.h"
+
+ #ifdef __cplusplus
+--
+2.9.0
+