public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gprofng: Don't hardcode -Wno-nonnull-compare
@ 2022-03-16 13:44 H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2022-03-16 13:44 UTC (permalink / raw)
To: bfd-cvs, gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a8b34706ef017a2032a78892a8595d36029f85a3
commit a8b34706ef017a2032a78892a8595d36029f85a3
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Mar 15 08:52:30 2022 -0700
gprofng: Don't hardcode -Wno-nonnull-compare
Use -Wno-nonnull-compare only if it is supported.
PR gprof/28969
* libcollector/Makefile.am (AM_CFLAGS): Replace
-Wno-nonnull-compare with GPROFNG_NO_NONNULL_COMPARE_CFLAGS.
* libcollector/configure.ac (GPROFNG_NO_NONNULL_COMPARE_CFLAGS):
New AC_SUBST for -Wno-nonnull-compare.
* libcollector/Makefile.in: Regenerate.
* libcollector/aclocal.m4: Likewise.
* libcollector/configure: Likewise.
Diff:
---
gprofng/libcollector/Makefile.am | 2 +-
gprofng/libcollector/Makefile.in | 3 +-
gprofng/libcollector/aclocal.m4 | 1 +
gprofng/libcollector/configure | 64 +++++++++++++++++++++++++++++++++++++--
gprofng/libcollector/configure.ac | 3 ++
5 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/gprofng/libcollector/Makefile.am b/gprofng/libcollector/Makefile.am
index a41b92030e0..901d9a5f0ee 100644
--- a/gprofng/libcollector/Makefile.am
+++ b/gprofng/libcollector/Makefile.am
@@ -41,7 +41,7 @@ CSOURCES = \
collector.c \
$(NULL)
-AM_CFLAGS = $(GPROFNG_CFLAGS) -Wno-nonnull-compare
+AM_CFLAGS = $(GPROFNG_CFLAGS) $(GPROFNG_NO_NONNULL_COMPARE_CFLAGS)
AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -I.. -I$(srcdir) \
-I$(srcdir)/../common -I$(srcdir)/../src \
-I$(srcdir)/../../include
diff --git a/gprofng/libcollector/Makefile.in b/gprofng/libcollector/Makefile.in
index f9ed2d95db5..55039aa12af 100644
--- a/gprofng/libcollector/Makefile.in
+++ b/gprofng/libcollector/Makefile.in
@@ -324,6 +324,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+GPROFNG_NO_NONNULL_COMPARE_CFLAGS = @GPROFNG_NO_NONNULL_COMPARE_CFLAGS@
GPROFNG_VARIANT = @GPROFNG_VARIANT@
GREP = @GREP@
INSTALL = @INSTALL@
@@ -437,7 +438,7 @@ CSOURCES = \
collector.c \
$(NULL)
-AM_CFLAGS = $(GPROFNG_CFLAGS) -Wno-nonnull-compare
+AM_CFLAGS = $(GPROFNG_CFLAGS) $(GPROFNG_NO_NONNULL_COMPARE_CFLAGS)
AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -I.. -I$(srcdir) \
-I$(srcdir)/../common -I$(srcdir)/../src \
-I$(srcdir)/../../include
diff --git a/gprofng/libcollector/aclocal.m4 b/gprofng/libcollector/aclocal.m4
index b269c739e73..2d13dba8c20 100644
--- a/gprofng/libcollector/aclocal.m4
+++ b/gprofng/libcollector/aclocal.m4
@@ -1230,6 +1230,7 @@ AC_SUBST([am__untar])
m4_include([../../config/depstand.m4])
m4_include([../../config/lead-dot.m4])
m4_include([../../config/override.m4])
+m4_include([../../config/warnings.m4])
m4_include([../../libtool.m4])
m4_include([../../ltoptions.m4])
m4_include([../../ltsugar.m4])
diff --git a/gprofng/libcollector/configure b/gprofng/libcollector/configure
index 887d2719910..5a853652d95 100755
--- a/gprofng/libcollector/configure
+++ b/gprofng/libcollector/configure
@@ -634,6 +634,7 @@ am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
CLOCK_GETTIME_LINK
+GPROFNG_NO_NONNULL_COMPARE_CFLAGS
GPROFNG_VARIANT
CXXCPP
OTOOL64
@@ -12014,7 +12015,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12017 "configure"
+#line 12018 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12120,7 +12121,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12123 "configure"
+#line 12124 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15438,6 +15439,65 @@ case "${target}" in
esac
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+GPROFNG_NO_NONNULL_COMPARE_CFLAGS=
+save_CFLAGS="$CFLAGS"
+for real_option in -Wno-nonnull-compare; do
+ # Do the check with the no- prefix removed since gcc silently
+ # accepts any -Wno-* option on purpose
+ case $real_option in
+ -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
+ *) option=$real_option ;;
+ esac
+ as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
+$as_echo_n "checking whether $CC supports $option... " >&6; }
+if eval \${$as_acx_Woption+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ CFLAGS="$option"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$as_acx_Woption=yes"
+else
+ eval "$as_acx_Woption=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+eval ac_res=\$$as_acx_Woption
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
+ GPROFNG_NO_NONNULL_COMPARE_CFLAGS="$GPROFNG_NO_NONNULL_COMPARE_CFLAGS${GPROFNG_NO_NONNULL_COMPARE_CFLAGS:+ }$real_option"
+fi
+ done
+CFLAGS="$save_CFLAGS"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
clock_gettime_link=
# At least for glibc, clock_gettime is in librt. But don't
# pull that in if it still doesn't give us the function we want. This
diff --git a/gprofng/libcollector/configure.ac b/gprofng/libcollector/configure.ac
index bc8c3f1e144..d82733fbc39 100644
--- a/gprofng/libcollector/configure.ac
+++ b/gprofng/libcollector/configure.ac
@@ -54,6 +54,9 @@ case "${target}" in
esac
AC_SUBST(GPROFNG_VARIANT)
+ACX_PROG_CC_WARNING_OPTS([-Wno-nonnull-compare], [GPROFNG_NO_NONNULL_COMPARE_CFLAGS])
+AC_SUBST(GPROFNG_NO_NONNULL_COMPARE_CFLAGS)
+
clock_gettime_link=
# At least for glibc, clock_gettime is in librt. But don't
# pull that in if it still doesn't give us the function we want. This
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-16 13:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 13:44 [binutils-gdb] gprofng: Don't hardcode -Wno-nonnull-compare H.J. Lu
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).