public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: put user-supplied CFLAGS at the end
@ 2020-10-05 16:40 Simon Marchi
  2020-10-07 12:10 ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2020-10-05 16:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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


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

end of thread, other threads:[~2020-10-07 17:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 16:40 [PATCH] gdb: put user-supplied CFLAGS at the end Simon Marchi
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

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).