public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH 3/3] gprofng: Don't hardcode -Wno-format-truncation/-Wno-switch
Date: Tue, 15 Mar 2022 09:22:04 -0700	[thread overview]
Message-ID: <20220315162204.2659495-4-hjl.tools@gmail.com> (raw)
In-Reply-To: <20220315162204.2659495-1-hjl.tools@gmail.com>

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.
---
 gprofng/Makefile.in     |   2 +
 gprofng/configure       | 122 +++++++++++++++++++++++++++++++++++++++-
 gprofng/configure.ac    |   4 ++
 gprofng/src/Makefile.am |   5 +-
 gprofng/src/Makefile.in |   8 ++-
 5 files changed, 135 insertions(+), 6 deletions(-)

diff --git a/gprofng/configure.ac b/gprofng/configure.ac
index 394e8b8837c..54a4279d6f5 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=
@@ -190,6 +192,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 b874b5b32aa..84fd1df9a44 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 \
-- 
2.35.1


  parent reply	other threads:[~2022-03-15 16:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 16:22 [PATCH 0/3] gprofng: Support build with older versions of GCC H.J. Lu
2022-03-15 16:22 ` [PATCH 1/3] gprofng: Define ATTRIBUTE_FALLTHROUGH H.J. Lu
2022-03-15 20:10   ` Jose E. Marchesi
2022-03-15 16:22 ` [PATCH 2/3] gprofng: Don't hardcode -Wno-nonnull-compare H.J. Lu
2022-03-15 16:22 ` H.J. Lu [this message]
2022-03-16  0:49 ` [PATCH 0/3] gprofng: Support build with older versions of GCC Alan Modra

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=20220315162204.2659495-4-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    /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 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).