about summary refs log tree commit diff
path: root/include/features.h
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2020-12-10 16:47:02 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2020-12-31 16:55:21 +0530
commit2a08b6e8331a611dc29325bfa6e29fecc9a3a46e (patch)
tree7cb26afcc4645260b22bf1c0f01d57668bd7d1f3 /include/features.h
parent41f013cef24884604c303435dd1915be2ea5c0e0 (diff)
downloadglibc-2a08b6e8331a611dc29325bfa6e29fecc9a3a46e.tar.gz
glibc-2a08b6e8331a611dc29325bfa6e29fecc9a3a46e.tar.xz
glibc-2a08b6e8331a611dc29325bfa6e29fecc9a3a46e.zip
Warn on unsupported fortification levels
Make the _FORTIFY_SOURCE macro soup in features.h warn about
unsupported fortification levels.  For example, it will warn about
_FORTIFY_SOURCE=3 and over with an indication of which level has been
selected.

Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
Diffstat (limited to 'include/features.h')
-rw-r--r--include/features.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/features.h b/include/features.h
index f3e62d3362..540230b90b 100644
--- a/include/features.h
+++ b/include/features.h
@@ -398,6 +398,9 @@
 # elif !__GNUC_PREREQ (4, 1)
 #  warning _FORTIFY_SOURCE requires GCC 4.1 or later
 # elif _FORTIFY_SOURCE > 1
+#  if _FORTIFY_SOURCE > 2
+#   warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform
+#  endif
 #  define __USE_FORTIFY_LEVEL 2
 # else
 #  define __USE_FORTIFY_LEVEL 1