aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-07-30 17:37:42 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-07-30 17:37:42 -0700
commit50200cc0d3d9847d40c5ed3ff87c47c1bde5d6dc (patch)
tree76ce7b8abc04f2f3aea3706af53b2b2673323755
parentc9467688b459b9478cb9faca47ed0b049cfbaeaa (diff)
downloadnasm-50200cc0d3d9847d40c5ed3ff87c47c1bde5d6dc.tar.gz
nasm-50200cc0d3d9847d40c5ed3ff87c47c1bde5d6dc.tar.xz
nasm-50200cc0d3d9847d40c5ed3ff87c47c1bde5d6dc.zip
configure.ac: add option to compile with suggestion warnings
Add a configure option to enable suggestion warnings, currently a set of -Wsuggest-attribute=* warnings. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--configure.ac12
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7b727693..17132af9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -396,6 +396,18 @@ PA_ARG_ENABLED([werror],
PA_ADD_CFLAGS([-Werror=vla])]
)
+dnl Warnings that are probabilistic based on the compiler version, and
+dnl only should be used specifically when looking for opportunities to
+dnl address or optimize these cases.
+PA_ARG_ENABLED([suggestions],
+ [compile with compiler suggestion warnings enabled],
+ [PA_ADD_CFLAGS([-Wsuggest-attribute=pure])
+ PA_ADD_CFLAGS([-Wsuggest-attribute=const])
+ PA_ADD_CFLAGS([-Wsuggest-attribute=noreturn])
+ PA_ADD_CFLAGS([-Wsuggest-attribute=format])
+ PA_ADD_CFLAGS([-Wsuggest-attribute=cold])
+ PA_ADD_CFLAGS([-Wsuggest-attribute=malloc])])
+
dnl
dnl Test compiler features. On some compilers, this can be affected
dnl by -Werror options, so run this *after* those options are added.