From: Justin Mitchell <jumitche@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Cc: Steve Dickson <steved@redhat.com>
Subject: [PATCH] nfs-utils: Test if extra compiler warnings are available
Date: Wed, 07 Mar 2018 17:37:26 +0000 [thread overview]
Message-ID: <1520444246.7682.9.camel@redhat.com> (raw)
Some of the latest compiler warnings flags are not available
on older compilers so this adds macros to test they are supported
Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
configure.ac | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index f4eba1f..e0c9039 100644
--- a/configure.ac
+++ b/configure.ac
@@ -550,7 +550,6 @@ my_am_cflags="\
-Werror=strict-prototypes \
-Werror=missing-prototypes \
-Werror=missing-declarations \
- -Werror=format-overflow=2 \
-Werror=format=2 \
-Werror=undef \
-Werror=missing-include-dirs \
@@ -560,15 +559,29 @@ my_am_cflags="\
-Werror=return-type \
-Werror=switch \
-Werror=overflow \
- -Werror=int-conversion \
-Werror=parentheses \
- -Werror=incompatible-pointer-types \
- -Werror=misleading-indentation \
-Werror=aggregate-return \
-Werror=unused-result \
-fno-strict-aliasing \
"
+AC_DEFUN([CHECK_CCSUPPORT], [
+ my_save_cflags="$CFLAGS"
+ CFLAGS=$1
+ AC_MSG_CHECKING([whether CC supports $1])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [AC_MSG_RESULT([yes])]
+ [$2+=$1],
+ [AC_MSG_RESULT([no])]
+ )
+ CFLAGS="$my_save_cflags"
+])
+
+CHECK_CCSUPPORT([-Werror=format-overflow=2], [my_am_cflags])
+CHECK_CCSUPPORT([-Werror=int-conversion], [my_am_cflags])
+CHECK_CCSUPPORT([-Werror=incompatible-pointer-types], [my_am_cflags])
+CHECK_CCSUPPORT([-Werror=misleading-indentation], [my_am_cflags])
+
AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
# Make sure that $ACLOCAL_FLAGS are used during a rebuild
--
1.8.3.1
next reply other threads:[~2018-03-07 17:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-07 17:37 Justin Mitchell [this message]
2018-03-10 16:34 ` [PATCH] nfs-utils: Test if extra compiler warnings are available Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1520444246.7682.9.camel@redhat.com \
--to=jumitche@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.