From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/7] [sim] Include defs.h via command line
Date: Tue, 17 Nov 2026 18:25:47 +0100 [thread overview]
Message-ID: <20261117172552.3083331-3-tdevries@suse.de> (raw)
In-Reply-To: <20261117172552.3083331-1-tdevries@suse.de>
Most sim files have:
...
/* This must come before any other includes. */
#include "defs.h"
...
This approach is error-prone: when adding a file, if it doesn't cause
compilation errors, it's easy to overlook, but it can cause compilation errors
later on.
I ran into this after updating gnulib, which broke compilation in 33 files:
...
$ grep -c "Error 1" build/MAKELOG
33
...
Fix this for all files at once, by adding a one-liner in sim/Makefile.am that
adds "-include $(srcdir)/common/defs.h".
---
sim/Makefile.am | 1 +
sim/Makefile.in | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/sim/Makefile.am b/sim/Makefile.am
index f921ea30e2c..497b48589c2 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -58,6 +58,7 @@ AM_CPPFLAGS = \
-I.. \
-I$(@D) \
-I$(srcdir)/$(@D) \
+ -include $(srcdir)/common/defs.h \
$(SIM_HW_CFLAGS) \
$(SIM_INLINE) \
$(AM_CPPFLAGS_$(subst -,_,$(@D))) \
diff --git a/sim/Makefile.in b/sim/Makefile.in
index 2a23b5c2eaa..fb3100e9a03 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -1875,7 +1875,8 @@ AM_CFLAGS = \
$(AM_CFLAGS_$(subst -,_,$(@D)_$(@F)))
AM_CPPFLAGS = $(INCGNU) -I$(srcroot) -I$(srcroot)/include -I../bfd \
- -I.. -I$(@D) -I$(srcdir)/$(@D) $(SIM_HW_CFLAGS) $(SIM_INLINE) \
+ -I.. -I$(@D) -I$(srcdir)/$(@D) -include \
+ $(srcdir)/common/defs.h $(SIM_HW_CFLAGS) $(SIM_INLINE) \
$(AM_CPPFLAGS_$(subst -,_,$(@D))) $(AM_CPPFLAGS_$(subst \
-,_,$(@D)_$(@F))) -I$(srcdir)/common -DSIM_TOPDIR_BUILD
AM_CPPFLAGS_FOR_BUILD = -I$(srcroot)/include $(SIM_HW_CFLAGS) \
--
2.51.0
next prev parent reply other threads:[~2026-11-17 17:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 17:25 [PATCH 0/7] [gnulib, stable-202607] Update to latest stable branch Tom de Vries
2026-11-17 17:25 ` [PATCH 1/7] [gdb] Handle overloaded strncasecmp in find_label_symbols_in_block Tom de Vries
2026-11-17 17:25 ` Tom de Vries [this message]
2026-11-17 17:25 ` [PATCH 3/7] [gnulib, stable-202607] Update GNULIB_COMMIT_SHA1 Tom de Vries
2026-11-17 17:25 ` [PATCH 4/7] [gnulib, stable-202607] Update 0002-no-solaris-_gl_attribute_dealloc Tom de Vries
2026-11-17 17:25 ` [PATCH 5/7] [gnulib, stable-202607] Add streq to IMPORTED_GNULIB_MODULES Tom de Vries
2026-11-17 17:25 ` [PATCH 6/7] [gnulib, stable-202607] Call gnulib-tool with --avoid=pthread-once Tom de Vries
2026-11-17 17:25 ` [PATCH 7/7] [gnulib, stable-202607] Run update-gnulib.sh Tom de Vries
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=20261117172552.3083331-3-tdevries@suse.de \
--to=tdevries@suse.de \
--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