00c0d4
commit 2a08b6e8331a611dc29325bfa6e29fecc9a3a46e
00c0d4
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
00c0d4
Date:   Thu Dec 10 16:47:02 2020 +0530
00c0d4
00c0d4
    Warn on unsupported fortification levels
00c0d4
    
00c0d4
    Make the _FORTIFY_SOURCE macro soup in features.h warn about
00c0d4
    unsupported fortification levels.  For example, it will warn about
00c0d4
    _FORTIFY_SOURCE=3 and over with an indication of which level has been
00c0d4
    selected.
00c0d4
    
00c0d4
    Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
00c0d4
00c0d4
diff --git a/include/features.h b/include/features.h
00c0d4
index 5bed0a499605a3a2..ea7673ee115bcf0a 100644
00c0d4
--- a/include/features.h
00c0d4
+++ b/include/features.h
00c0d4
@@ -382,6 +382,9 @@
00c0d4
 # elif !__GNUC_PREREQ (4, 1)
00c0d4
 #  warning _FORTIFY_SOURCE requires GCC 4.1 or later
00c0d4
 # elif _FORTIFY_SOURCE > 1
00c0d4
+#  if _FORTIFY_SOURCE > 2
00c0d4
+#   warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform
00c0d4
+#  endif
00c0d4
 #  define __USE_FORTIFY_LEVEL 2
00c0d4
 # else
00c0d4
 #  define __USE_FORTIFY_LEVEL 1