From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 1/DOLb7S52nUtjAAWB0awg (envelope-from ) for ; Tue, 21 Apr 2026 15:40:46 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=kXMXyhKI; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MJNa0cRA; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xgdMyzpg; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=HIaw6qST; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A9F6F1E093; Tue, 21 Apr 2026 15:40:46 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 103A01E093 for ; Tue, 21 Apr 2026 15:40:45 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id D799A4BA9010 for ; Tue, 21 Apr 2026 19:40:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D799A4BA9010 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=kXMXyhKI; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MJNa0cRA; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xgdMyzpg; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=HIaw6qST Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 6855F4BA23EB for ; Tue, 21 Apr 2026 19:40:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6855F4BA23EB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6855F4BA23EB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776800416; cv=none; b=Pde6lOUF2ZlDztBOfrNsW/jEN1qy9vldyw0XczOr8AyT6IlCYGRU4/qytC1OypkviyyorTH+AVlR9QSn3KcTLUutU4k1rdlBL1HciRFIqViGiT/Eo84EduQY0JwJUQqlW62i9hs6kWlLccPYEtuEa10VUHpVYrwyzzim50EWsOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776800416; c=relaxed/simple; bh=Kjsd3qubwqnkKUbxwN491CkN+f/6QZCajRT4iRxLuIo=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=Jw93M5BB0c5bUQDgj5SQw6g+QVy8KujQ9w4ylBylczZgox87NEwTu/eIWqTT+aJCBhxUvBnCzGW7YalzDpR3z1GoiE1aPExMF7KmJxLuDissK9VZSJzlwKv5qmNA9xajtcef8Cplp0ICBOg648aA8dGfMIdQfcrwEmQiCccthUg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6855F4BA23EB Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 52ECA6A806 for ; Tue, 21 Apr 2026 19:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776800414; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NKH82mMYMfYX55XAfbs+BuM0b98Xt8+veCsAuNK2Xaw=; b=kXMXyhKIKMi6FOoA8s+8i3MVylhUjTqBPtb98Fxvh9/l4n2n40fvzQh7441hsyifnBa2Fs zZAYeMAkO9pyFPENaY09WIZ6p9N4HPR2t6ioBcmuc2KW9NrloI37mZ5AQEOQ99b4d8oG5x 34O8Bw0eSOf9GN7fqyD05apKVuNQPWA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776800414; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NKH82mMYMfYX55XAfbs+BuM0b98Xt8+veCsAuNK2Xaw=; b=MJNa0cRAM3QV98kLSE+hSPZFSJjogy+A3BZXDi1sVkjx0TajNrw8H8c571z5ioUPHGH2bM wQ6FnBWIr64GW0Dw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xgdMyzpg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HIaw6qST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776800412; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NKH82mMYMfYX55XAfbs+BuM0b98Xt8+veCsAuNK2Xaw=; b=xgdMyzpgayOLXODUg15hMjbMTyD9H+F0cglALJxZlM71yDWKOINIM5E+76oojagBWOvNfT uBFh/NcG/Ns7fpYm1g9E7YQmD+dWk2UMzew5LBTSz2S2nf3yepml3hgXUUU4jzevFUxebJ +hYs5IE3VH+nncFGUxkqQGtZrqLYSmA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776800412; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NKH82mMYMfYX55XAfbs+BuM0b98Xt8+veCsAuNK2Xaw=; b=HIaw6qST5heBnvtzNf1WtOGF3ppKr0HsvV4kevWC2OdzHAJqJQTIQPoa4dho5bMqu6g9AK faZNQUpi6NEfJtBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3E5BB593AF for ; Tue, 21 Apr 2026 19:40:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YPv5DZzS52mFdgAAD6G6ig (envelope-from ) for ; Tue, 21 Apr 2026 19:40:12 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v2] [gdb] Remove unnecessary defs.h/common-defs.h includes Date: Tue, 21 Apr 2026 21:40:11 +0200 Message-ID: <20260421194011.1982212-1-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_NONE(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns, sourceware.org:url, gnu.org:url] X-Rspamd-Queue-Id: 52ECA6A806 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org I asked an AI to review a patch that added a new file, and it mentioned I should add an include of defs.h as first include. That used to be true, but since commit 18d2988e5da ("gdb, gdbserver, gdbsupport: remove includes of early headers") that's not the case anymore. Error out when encountering a second include of defs.h, and remove a few of those. While we're at it, do the same for gdbsupport/common-defs.h and gdbserver/server.h. Tested by rebuilding gdb on x86_64-linux. V1 submitted here [1]. Changes in v1: - also handle gdbserver/server.h - change error message to use "manually" instead of "twice" [1] https://sourceware.org/pipermail/gdb-patches/2026-April/226694.html --- gdb/amd64-gnu-tdep.c | 1 - gdb/break-cond-parse.c | 1 - gdb/defs.h | 2 ++ gdb/nat/x86-linux.c | 1 - gdb/riscv-linux-canonicalize-syscall-gen.c | 1 - gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py | 1 - gdb/unittests/remote-arg-selftests.c | 1 - gdbserver/linux-microblaze-low.cc | 1 - gdbserver/server.h | 2 ++ gdbsupport/common-defs.h | 2 ++ gdbsupport/remote-args.cc | 1 - 11 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gdb/amd64-gnu-tdep.c b/gdb/amd64-gnu-tdep.c index 366cc4584ad..8415ce7468a 100644 --- a/gdb/amd64-gnu-tdep.c +++ b/gdb/amd64-gnu-tdep.c @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "defs.h" #include "extract-store-integer.h" #include "gdbcore.h" #include "osabi.h" diff --git a/gdb/break-cond-parse.c b/gdb/break-cond-parse.c index 4fec4dbef94..7cb70df378c 100644 --- a/gdb/break-cond-parse.c +++ b/gdb/break-cond-parse.c @@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "defs.h" #include "gdbsupport/gdb_assert.h" #include "gdbsupport/selftest.h" #include "test-target.h" diff --git a/gdb/defs.h b/gdb/defs.h index 6029a2144d0..90abf0d3432 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -397,4 +397,6 @@ DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what); extern void _initialize_ ## NAME (); \ void _initialize_ ## NAME () +#else +# error gdb/defs.h should not be included manually #endif /* GDB_DEFS_H */ diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c index 92979ae652d..16391dcde24 100644 --- a/gdb/nat/x86-linux.c +++ b/gdb/nat/x86-linux.c @@ -18,7 +18,6 @@ along with this program. If not, see . */ #include "elf/common.h" -#include "gdbsupport/common-defs.h" #include "nat/gdb_ptrace.h" #include "nat/linux-ptrace.h" #include "nat/x86-cpuid.h" diff --git a/gdb/riscv-linux-canonicalize-syscall-gen.c b/gdb/riscv-linux-canonicalize-syscall-gen.c index be1eabcabc0..2d625bdfa8c 100644 --- a/gdb/riscv-linux-canonicalize-syscall-gen.c +++ b/gdb/riscv-linux-canonicalize-syscall-gen.c @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "defs.h" #include "riscv-linux-tdep.h" /* riscv_linux_canonicalize_syscall maps from the native RISC-V Linux set diff --git a/gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py b/gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py index ca7dbe0b306..63b359f226b 100755 --- a/gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py +++ b/gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py @@ -59,7 +59,6 @@ HEAD = f"""\ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "defs.h" #include "riscv-linux-tdep.h" /* riscv_linux_canonicalize_syscall maps from the native RISC-V Linux set diff --git a/gdb/unittests/remote-arg-selftests.c b/gdb/unittests/remote-arg-selftests.c index e878fefb2ef..7d4e63deefd 100644 --- a/gdb/unittests/remote-arg-selftests.c +++ b/gdb/unittests/remote-arg-selftests.c @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "defs.h" #include "gdbsupport/selftest.h" #include "gdbsupport/buildargv.h" #include "gdbsupport/common-inferior.h" diff --git a/gdbserver/linux-microblaze-low.cc b/gdbserver/linux-microblaze-low.cc index e5bdba12dfc..21793d9a801 100644 --- a/gdbserver/linux-microblaze-low.cc +++ b/gdbserver/linux-microblaze-low.cc @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "server.h" #include "linux-low.h" #include "elf/common.h" diff --git a/gdbserver/server.h b/gdbserver/server.h index 284f61821c0..bbba3650de7 100644 --- a/gdbserver/server.h +++ b/gdbserver/server.h @@ -214,4 +214,6 @@ client_state &get_client_state (); #include "gdbthread.h" #include "inferiors.h" +#else +# error gdbserver/server.h should not be included manually #endif /* GDBSERVER_SERVER_H */ diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index f181044f383..1c0ae0ad9d1 100644 --- a/gdbsupport/common-defs.h +++ b/gdbsupport/common-defs.h @@ -237,4 +237,6 @@ #define HAVE_USEFUL_SBRK 1 #endif +#else +# error gdbsupport/common-defs.h should not be included manually #endif /* GDBSUPPORT_COMMON_DEFS_H */ diff --git a/gdbsupport/remote-args.cc b/gdbsupport/remote-args.cc index 232adbff998..2abf61aa86b 100644 --- a/gdbsupport/remote-args.cc +++ b/gdbsupport/remote-args.cc @@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "gdbsupport/common-defs.h" #include "gdbsupport/remote-args.h" #include "gdbsupport/common-inferior.h" #include "gdbsupport/buildargv.h" base-commit: 8927b500532538cd86aae2d777c6452c51a210c6 -- 2.51.0