aboutsummaryrefslogtreecommitdiff
path: root/gprofng
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-03-15 08:56:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-03-16 06:43:24 -0700
commit61a1f2e71118206dd700fc1ddf244b2178bf6610 (patch)
tree7618b0051db2116a8b36a8824c09c10c620fd623 /gprofng
parenta8b34706ef017a2032a78892a8595d36029f85a3 (diff)
downloadgdb-61a1f2e71118206dd700fc1ddf244b2178bf6610.zip
gdb-61a1f2e71118206dd700fc1ddf244b2178bf6610.tar.gz
gdb-61a1f2e71118206dd700fc1ddf244b2178bf6610.tar.bz2
gprofng: Don't hardcode -Wno-format-truncation/-Wno-switch
Use -Wno-format-truncation and -Wno-switch only if they are supported. PR gprof/28969 * configure.ac (GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS): New AC_SUBST for -Wno-format-truncation. (GPROFNG_NO_SWITCH_CFLAGS): New AC_SUBST for -Wno-switch. * Makefile.in: Regenerate. * configure: Likewise. * src/Makefile.am (AM_CFLAGS): Replace -Wno-format-truncation and -Wno-switch with GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS and GPROFNG_NO_SWITCH_CFLAGS. * src/Makefile.in: Regenerate.
Diffstat (limited to 'gprofng')
-rw-r--r--gprofng/Makefile.in2
-rwxr-xr-xgprofng/configure122
-rw-r--r--gprofng/configure.ac4
-rw-r--r--gprofng/src/Makefile.am5
-rw-r--r--gprofng/src/Makefile.in7
5 files changed, 134 insertions, 6 deletions
diff --git a/gprofng/Makefile.in b/gprofng/Makefile.in
index 08ffdd2..62005dc 100644
--- a/gprofng/Makefile.in
+++ b/gprofng/Makefile.in
@@ -265,6 +265,8 @@ GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
GPROFNG_LIBADD = @GPROFNG_LIBADD@
GPROFNG_LIBDIR = @GPROFNG_LIBDIR@
+GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS = @GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS@
+GPROFNG_NO_SWITCH_CFLAGS = @GPROFNG_NO_SWITCH_CFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/gprofng/configure b/gprofng/configure
index 9a4a334..1371caa 100755
--- a/gprofng/configure
+++ b/gprofng/configure
@@ -658,6 +658,8 @@ BUILD_SRC_FALSE
BUILD_SRC_TRUE
BUILD_COLLECTOR_FALSE
BUILD_COLLECTOR_TRUE
+GPROFNG_NO_SWITCH_CFLAGS
+GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS
gprofng_cflags
WERROR
GPROFNG_LIBADD
@@ -12089,7 +12091,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12092 "configure"
+#line 12094 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12195,7 +12197,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12198 "configure"
+#line 12200 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15530,6 +15532,120 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+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_FORMAT_TRUNCATION_CFLAGS=
+save_CFLAGS="$CFLAGS"
+for real_option in -Wno-format-truncation; 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_FORMAT_TRUNCATION_CFLAGS="$GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS${GPROFNG_NO_FORMAT_TRUNCATION_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
+
+
+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_SWITCH_CFLAGS=
+save_CFLAGS="$CFLAGS"
+for real_option in -Wno-switch; 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_SWITCH_CFLAGS="$GPROFNG_NO_SWITCH_CFLAGS${GPROFNG_NO_SWITCH_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
+
+
gprofng_cppflags="-U_ASM"
build_collector=
build_src=
@@ -16507,6 +16623,8 @@ LD_NO_AS_NEEDED=${no_as_needed}
GPROFNG_CFLAGS=${gprofng_cflags}
+
+
GPROFNG_CPPFLAGS=${gprofng_cppflags}
GPROFNG_LIBDIR=${libdir}
diff --git a/gprofng/configure.ac b/gprofng/configure.ac
index fa924dc..23fee87 100644
--- a/gprofng/configure.ac
+++ b/gprofng/configure.ac
@@ -42,6 +42,8 @@ AC_SUBST(GPROFNG_LIBADD)
ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
ACX_PROG_CC_WARNING_OPTS([-Wall], [gprofng_cflags])
+ACX_PROG_CC_WARNING_OPTS([-Wno-format-truncation], [GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS])
+ACX_PROG_CC_WARNING_OPTS([-Wno-switch], [GPROFNG_NO_SWITCH_CFLAGS])
gprofng_cppflags="-U_ASM"
build_collector=
build_src=
@@ -174,6 +176,8 @@ AM_CONDITIONAL([BUILD_MAN], [test x$build_man = xtrue])
AC_SUBST(LD_NO_AS_NEEDED, [${no_as_needed}])
AC_SUBST(GPROFNG_CFLAGS, [${gprofng_cflags}])
+AC_SUBST(GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS)
+AC_SUBST(GPROFNG_NO_SWITCH_CFLAGS)
AC_SUBST(GPROFNG_CPPFLAGS, [${gprofng_cppflags}])
AC_SUBST(GPROFNG_LIBDIR, [${libdir}])
diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
index b874b5b..84fd1df 100644
--- a/gprofng/src/Makefile.am
+++ b/gprofng/src/Makefile.am
@@ -102,8 +102,9 @@ AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -DLOCALEDIR=\"@localedir@\" -I.. -I$(srcdir) \
-I$(srcdir)/../common \
-I$(srcdir)/../../include -I$(srcdir)/../../opcodes \
-I../../bfd -I$(srcdir)/../../bfd
-AM_CFLAGS = $(GPROFNG_CFLAGS) $(PTHREAD_CFLAGS) -Wno-switch \
- -Wno-format-truncation
+AM_CFLAGS = $(GPROFNG_CFLAGS) $(PTHREAD_CFLAGS) \
+ $(GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS) \
+ $(GPROFNG_NO_SWITCH_CFLAGS)
AM_CXXFLAGS = $(AM_CFLAGS)
man_MANS = gprofng.1 \
diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
index f21671d..6b3c82b 100644
--- a/gprofng/src/Makefile.in
+++ b/gprofng/src/Makefile.in
@@ -330,6 +330,8 @@ GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
GPROFNG_LIBADD = @GPROFNG_LIBADD@
GPROFNG_LIBDIR = @GPROFNG_LIBDIR@
+GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS = @GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS@
+GPROFNG_NO_SWITCH_CFLAGS = @GPROFNG_NO_SWITCH_CFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
@@ -517,8 +519,9 @@ AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -DLOCALEDIR=\"@localedir@\" -I.. -I$(srcdir) \
-I$(srcdir)/../../include -I$(srcdir)/../../opcodes \
-I../../bfd -I$(srcdir)/../../bfd
-AM_CFLAGS = $(GPROFNG_CFLAGS) $(PTHREAD_CFLAGS) -Wno-switch \
- -Wno-format-truncation
+AM_CFLAGS = $(GPROFNG_CFLAGS) $(PTHREAD_CFLAGS) \
+ $(GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS) \
+ $(GPROFNG_NO_SWITCH_CFLAGS)
AM_CXXFLAGS = $(AM_CFLAGS)
man_MANS = gprofng.1 \