From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vWcbG/qk52lDgjAAWB0awg (envelope-from ) for ; Tue, 21 Apr 2026 12:25:30 -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=R31NCQwe; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=KsBq0RKn; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=awHKxWXF; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SZXkJuYq; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5F2C71E0C3; Tue, 21 Apr 2026 12:25:30 -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 40F281E093 for ; Tue, 21 Apr 2026 12:25:29 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B0E264B9DB41 for ; Tue, 21 Apr 2026 16:25:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0E264B9DB41 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=R31NCQwe; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=KsBq0RKn; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=awHKxWXF; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SZXkJuYq Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id E88584BA23C8 for ; Tue, 21 Apr 2026 16:24:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E88584BA23C8 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 E88584BA23C8 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776788697; cv=none; b=uZiT+EkSBX5mzN1aIt3/TopLtRyxbTbnDbpvgNYvAvfMVwdrg4hyG8FOfuM/Legual+T8oaZbUd7bk1TQI4CmyPMFo5HjiQyEbkeY03ttLdLm5+6kQjGNTNvt26RT1Jl4TYKa7SpzqLfewogxhwDAJgW+tA7xVaatWSSAfDsXiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776788697; c=relaxed/simple; bh=bnsEfktK9OMhGL+JGD9Bnuy+HqoIxwUKnf/qgrxV5nc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=qLFZyfvNf5ZAZA3e1CADmWKcBFf1r6ctBi/8950vRKD2bg23sC3elV/s4dDTMalru+87PwErdIHkjPwW79JDTvBo4LMz8fKxFo/MlkMrsHEVzgHZmxE6BA8qkSSMgyw1PwbrUs8LAx8Lk6llI2V5qvHNpTzNY7apIjapnluF4yE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E88584BA23C8 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 9002D6A800 for ; Tue, 21 Apr 2026 16:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776788695; 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=LlYL40cnlZJd/oGz4K93dFQ8CTYrnilr3vIZ6+/RSpk=; b=R31NCQweFlqECWTDXJc9bl1lebnh5H/BIFMwtwBayiN6NcJDaTYlt+AzbUS7mcaX4Zka7E u3iaoohF+Z4OIUiPQSIarLp4wyP4MiKHFyjQKTUBN1I3dvX+HvH6MHUAaOkti9y20ZfeFs wfvhMfncE34GFGRvLRpPzBr6Pt3YcAo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776788695; 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=LlYL40cnlZJd/oGz4K93dFQ8CTYrnilr3vIZ6+/RSpk=; b=KsBq0RKnOP7cb+l9eZ5davqR0Q5OQ/2COz+GT4sK63idIuojeghnuZZVomPuA1gvkbCXof o65tTPfV/p0TQlDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=awHKxWXF; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=SZXkJuYq DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776788694; 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=LlYL40cnlZJd/oGz4K93dFQ8CTYrnilr3vIZ6+/RSpk=; b=awHKxWXFRfCygs//Hoq7zgHip0sLNVixk2NOtQIBTsQoFxscHzs7DSpgFatIzRI88i7u12 RtocSpyErfGP5maVfh5ehS1KyTJVhG+EZZ2r0Rd8RwNFFU866gsamcUN3/hweE6dMsVeFA 8FNREVPNdnZzsMg1tY+RtQPxkDDisME= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776788694; 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=LlYL40cnlZJd/oGz4K93dFQ8CTYrnilr3vIZ6+/RSpk=; b=SZXkJuYqP7SW9x/iRBmEOgXrMOI6vxoWrB1rBrAZyZup/Cs/fr72jdazBXR28fNGYrR7Pf asgG3RhuU6ATSnBg== 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 76930593AF for ; Tue, 21 Apr 2026 16:24:54 +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 u0w+G9ak52lfPQAAD6G6ig (envelope-from ) for ; Tue, 21 Apr 2026 16:24:54 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb] Remove unnecessary defs.h/common-defs.h includes Date: Tue, 21 Apr 2026 18:24:54 +0200 Message-ID: <20260421162454.1720072-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)[imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns, suse.de:dkim, suse.de:mid, gnu.org:url] X-Rspamd-Queue-Id: 9002D6A800 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. Tested by rebuilding gdb on aarch64-linux. --- 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 - gdbsupport/common-defs.h | 2 ++ gdbsupport/remote-args.cc | 1 - 9 files changed, 4 insertions(+), 7 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..5070d04adae 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 twice #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/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index f181044f383..da94e38c60f 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 twice #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