aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoland Mc Grath <roland@hack.frob.com>2012-05-08 19:44:57 +0200
committerAndreas Jaeger <jaegerandi@gmail.com>2012-05-08 19:44:57 +0200
commit05c2c9618f583ea4acd69b3fe5ae2a2922dd2ddc (patch)
treecf5cd345bf757fd5296ff7e0b8dcd7f142fc3d37 /include
parent4b30f61a1ea78de9b0e84a54fc6ee96ea70e6ed5 (diff)
downloadglibc-05c2c9618f583ea4acd69b3fe5ae2a2922dd2ddc.zip
glibc-05c2c9618f583ea4acd69b3fe5ae2a2922dd2ddc.tar.gz
glibc-05c2c9618f583ea4acd69b3fe5ae2a2922dd2ddc.tar.bz2
Warn if user requests __FORTIFY_SOURCE but it is disabled
[BZ #13979] * include/features.h: Warn if user requests __FORTIFY_SOURCE checking but the checks are disabled for any reason.
Diffstat (limited to 'include')
-rw-r--r--include/features.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/features.h b/include/features.h
index c347555..c700871 100644
--- a/include/features.h
+++ b/include/features.h
@@ -325,14 +325,18 @@
# define __USE_REENTRANT 1
#endif
-#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
- && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
-# if _FORTIFY_SOURCE > 1
+#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0
+# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
+# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
+# elif !__GNUC_PREREQ (4, 1)
+# warning _FORTIFY_SOURCE requires GCC 4.1 or later
+# elif _FORTIFY_SOURCE > 1
# define __USE_FORTIFY_LEVEL 2
# else
# define __USE_FORTIFY_LEVEL 1
# endif
-#else
+#endif
+#ifndef __USE_FORTIFY_LEVEL
# define __USE_FORTIFY_LEVEL 0
#endif