public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH] gdb: put user-supplied CFLAGS at the end
Date: Mon,  5 Oct 2020 12:40:56 -0400	[thread overview]
Message-ID: <20201005164056.2756084-1-simon.marchi@efficios.com> (raw)

GDB currently doesn't build cleanly with clang (a -Wdeprecated-copy-dtor
error).  I configured my clang-based GDB build with
CXXFLAGS="-Wno-error=deprecated-copy-dtor", so I can use it despite that
problem.  However, I found that it had no effect.  This is because my
-Wno-error=Wdeprecated-copy-dtor switch is followed by -Werror in the
command line, which switches back all warnings to be errors.

If we want the user-supplied C(XX)FLAGS to be able to override flags
added by our configure script, the user-supplied C(XX)FLAGS should
appear after the configure-supplied flags.

This patch moves the user-supplied flags at the very end of the command
line, which fixes the problem described above.

gdb/ChangeLog:

	* Makefile (INTERNAL_CFLAGS_BASE): Move CXXFLAGS at the end.
	(INTERNAL_WARN_CFLAGS): Move INTERNAL_CFLAGS_BASE at the end.
	(INTERNAL_CFLAGS): Move INTERNAL_WARN_CFLAGS at the end.

Change-Id: I00e054506695e0e9536095c6d14827e48abd8f69
---
 gdb/Makefile.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index afce26276ecd..6f4b299452d5 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -598,14 +598,14 @@ INTERNAL_CPPFLAGS = $(CPPFLAGS) @GUILE_CPPFLAGS@ @PYTHON_CPPFLAGS@ \
 
 # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
 INTERNAL_CFLAGS_BASE = \
-	$(CXXFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
+	$(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
 	$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \
 	$(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
 	$(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(ENABLE_CFLAGS) \
 	$(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS) \
-	$(DEBUGINFOD_CFLAGS)
-INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
-INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
+	$(DEBUGINFOD_CFLAGS) $(CXXFLAGS)
+INTERNAL_WARN_CFLAGS = $(GDB_WARN_CFLAGS) $(INTERNAL_CFLAGS_BASE)
+INTERNAL_CFLAGS = $(GDB_WERROR_CFLAGS) $(INTERNAL_WARN_CFLAGS)
 
 # LDFLAGS is specifically reserved for setting from the command line
 # when running make.
-- 
2.26.2


             reply	other threads:[~2020-10-05 16:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 16:40 Simon Marchi [this message]
2020-10-07 12:10 ` Pedro Alves
2020-10-07 14:25   ` Simon Marchi
2020-10-07 15:27   ` [PATCH v2] " Simon Marchi
2020-10-07 17:34     ` Pedro Alves
2020-10-07 17:55       ` Simon Marchi

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=20201005164056.2756084-1-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@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).