public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] config: Check for and use gcc -Wnull-dereference.
@ 2016-02-22 11:11 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2016-02-22 11:11 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

On Sat, 2016-02-13 at 19:11 +0100, Mark Wielaard wrote:
> -Wnull-dereference is new in GCC6

Pushed to master.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] config: Check for and use gcc -Wnull-dereference.
@ 2016-02-13 18:11 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2016-02-13 18:11 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 2451 bytes --]

-Wnull-dereference is new in GCC6

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 ChangeLog        |  4 ++++
 config/ChangeLog |  5 +++++
 config/eu.am     |  7 +++++++
 configure.ac     | 10 ++++++++++
 4 files changed, 26 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index d206a8e..0a8166b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-02-13  Mark Wielaard  <mjw@redhat.com>
+
+	* configure.ac: Add check for whether gcc accepts -Wnull-dereference.
+
 2016-02-98  Mark Wielaard  <mjw@redhat.com>
 
 	* configure.ac: Add checks for sane -Wlogical-op and whether gcc
diff --git a/config/ChangeLog b/config/ChangeLog
index 8523cb3..494778a 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-13  Mark Wielaard  <mjw@redhat.com>
+
+	* eu.am: Check HAVE_NULL_DEREFERENCE_WARNING.
+	(AM_CFLAGS): Add NULL_DEREFERENCE_WARNING.
+
 2016-02-09  Mark Wielaard  <mjw@redhat.com>
 
 	* eu.am: Check SANE_LOGICAL_OP_WARNING and
diff --git a/config/eu.am b/config/eu.am
index c4e9279..4998771 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -55,9 +55,16 @@ else
 DUPLICATED_COND_WARNING=
 endif
 
+if HAVE_NULL_DEREFERENCE_WARNING
+NULL_DEREFERENCE_WARNING=-Wnull-dereference
+else
+NULL_DEREFERENCE_WARNING=
+endif
+
 AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
 	    -Wold-style-definition -Wstrict-prototypes \
 	    $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
+	    $(NULL_DEREFERENCE_WARNING) \
 	    $(if $($(*F)_no_Werror),,-Werror) \
 	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
 	    $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
diff --git a/configure.ac b/configure.ac
index d447db7..df58b5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -313,6 +313,16 @@ CFLAGS="$old_CFLAGS"])
 AM_CONDITIONAL(HAVE_DUPLICATED_COND_WARNING,
 	       [test "x$ac_cv_duplicated_cond" != "xno"])
 
+# -Wnull-dereference was added by GCC6
+AC_CACHE_CHECK([whether gcc accepts -Wnull-dereference], ac_cv_null_dereference, [dnl
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wnull-dereference"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
+		  ac_cv_null_dereference=yes, ac_cv_null_dereference=no)
+CFLAGS="$old_CFLAGS"])
+AM_CONDITIONAL(HAVE_NULL_DEREFERENCE_WARNING,
+	       [test "x$ac_cv_null_dereference" != "xno"])
+
 dnl Check if we have argp available from our libc
 AC_LINK_IFELSE(
 	[AC_LANG_PROGRAM(
-- 
2.5.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-22 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-22 11:11 [PATCH] config: Check for and use gcc -Wnull-dereference Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2016-02-13 18:11 Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).