From patchwork Wed Jan 3 08:37:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83221 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C911738582B8 for ; Wed, 3 Jan 2024 08:39:22 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 2A3BC3858D28 for ; Wed, 3 Jan 2024 08:37:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A3BC3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A3BC3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704271084; cv=none; b=I6QbbdiSdXdbawt9OHaqaNoLSjio/ZOc0oprkQK3zVdy4NCR3vJ++Fispq0261q6G6kxJfZl9Ohy2USH9x2y1GeoFaskzybymEEsoXXxkE5R5sXwRSC63GaNFEO9T68FFKPc412tfrI75EIGEVquTd3GRufQ2NcTQworjM39jGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704271084; c=relaxed/simple; bh=xXE0kzyQe0FnG0cx3ww9NCfQMj1kfm0HufNH4RpaiGk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=HGabvTIR4dl1SfrUP1hhkXMq0gnmnN5vp4/4aMJGJbKHX1yQdUfTEjKRUAqrpK2Fr24NR+MsXlQFE87NdxQRh7hAiUUqEvqcgytyieNZ5K0n6dUvMMtEM3vzmHn0rCNDZwcQET1V4m8xRgRHUhcq1SJcfzqPTBJiC1m4C/pO64o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id BBD1D342F94; Wed, 3 Jan 2024 08:37:53 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed 1/3] sim: igen: clean up headers a bit Date: Wed, 3 Jan 2024 03:37:49 -0500 Message-ID: <20240103083751.12013-1-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+patchwork=sourceware.org@sourceware.org Add standard multiple inclusion protection, and add a few missing local includes when one header uses another. This isn't complete, but fixes some short comings seen when merging the ppc igen. --- sim/igen/filter.h | 6 ++++++ sim/igen/filter_host.h | 7 ++++--- sim/igen/gen-engine.h | 5 +++++ sim/igen/gen-icache.h | 4 ++++ sim/igen/gen-idecode.h | 4 ++++ sim/igen/gen-itable.h | 5 ++++- sim/igen/gen-model.h | 5 ++++- sim/igen/gen-semantics.h | 4 ++++ sim/igen/gen-support.h | 4 ++++ sim/igen/gen.h | 4 ++++ sim/igen/igen.h | 4 ++++ sim/igen/ld-cache.h | 5 ++++- sim/igen/ld-decode.h | 4 ++++ sim/igen/ld-insn.h | 5 ++++- sim/igen/lf.h | 6 ++++++ sim/igen/misc.h | 5 ++++- sim/igen/table.h | 4 ++++ 17 files changed, 73 insertions(+), 8 deletions(-) diff --git a/sim/igen/filter.h b/sim/igen/filter.h index dd674dde26ae..b225731add0e 100644 --- a/sim/igen/filter.h +++ b/sim/igen/filter.h @@ -19,6 +19,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_FILTER_H +#define IGEN_FILTER_H + +#include "lf.h" /* NB, an empty filter is NULL */ typedef struct _filter filter; @@ -68,3 +72,5 @@ const char *filter_next (const filter *set, const char *member); extern void dump_filter (lf *file, const char *prefix, const filter *filt, const char *suffix); + +#endif /* IGEN_FILTER_H */ diff --git a/sim/igen/filter_host.h b/sim/igen/filter_host.h index 104c21063d62..b226a2111fa2 100644 --- a/sim/igen/filter_host.h +++ b/sim/igen/filter_host.h @@ -19,9 +19,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef _FILTER_HOST_H -#define _FILTER_HOST_H +#ifndef IGEN_FILTER_HOST_H +#define IGEN_FILTER_HOST_H /* Remove directory part from filename */ extern const char *filter_filename (const char *filename); -#endif + +#endif /* IGEN_FILTER_HOST_H */ diff --git a/sim/igen/gen-engine.h b/sim/igen/gen-engine.h index bb46bed147d9..20f341526f46 100644 --- a/sim/igen/gen-engine.h +++ b/sim/igen/gen-engine.h @@ -19,6 +19,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_GEN_ENGINE_H +#define IGEN_GEN_ENGINE_H + extern void gen_engine_h (lf *file, const gen_table *gen, const insn_table *isa, cache_entry *cache_rules); @@ -29,3 +32,5 @@ extern void gen_engine_c extern void print_engine_run_function_header (lf *file, const char *processor, function_decl_type decl_type); + +#endif /* IGEN_GEN_ENGINE_H */ diff --git a/sim/igen/gen-icache.h b/sim/igen/gen-icache.h index de8cdfe43071..f5298e564939 100644 --- a/sim/igen/gen-icache.h +++ b/sim/igen/gen-icache.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_GEN_ICACHE_H +#define IGEN_GEN_ICACHE_H /* Output code to manipulate the instruction cache: either create it or reference it */ @@ -79,3 +81,5 @@ extern void print_icache_struct /* Output a single instructions decoder */ + +#endif /* IGEN_GEN_ICACHE_H */ diff --git a/sim/igen/gen-idecode.h b/sim/igen/gen-idecode.h index 63ae883d2192..05a7055644a9 100644 --- a/sim/igen/gen-idecode.h +++ b/sim/igen/gen-idecode.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_GEN_IDECODE_H +#define IGEN_GEN_IDECODE_H void print_idecode_issue_function_header (lf *file, @@ -45,3 +47,5 @@ extern void print_idecode_validate (lf *file, const insn_entry *instruction, const insn_opcodes *opcode_paths); + +#endif /* IGEN_GEN_IDECODE_H */ diff --git a/sim/igen/gen-itable.h b/sim/igen/gen-itable.h index 37d39fe84b85..2991d18390ba 100644 --- a/sim/igen/gen-itable.h +++ b/sim/igen/gen-itable.h @@ -19,10 +19,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - +#ifndef IGEN_GEN_ITABLE_H +#define IGEN_GEN_ITABLE_H /* Output a table of all the instructions */ extern void gen_itable_h (lf *file, const insn_table *table); extern void gen_itable_c (lf *file, const insn_table *table); + +#endif /* IGEN_GEN_ITABLE_H */ diff --git a/sim/igen/gen-model.h b/sim/igen/gen-model.h index 5af5d9182625..2fdea67d4dc6 100644 --- a/sim/igen/gen-model.h +++ b/sim/igen/gen-model.h @@ -19,8 +19,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - +#ifndef IGEN_GEN_MODEL_H +#define IGEN_GEN_MODEL_H extern void gen_model_h (lf *file, const insn_table *isa); extern void gen_model_c (lf *file, const insn_table *isa); + +#endif /* IGEN_GEN_MODEL_H */ diff --git a/sim/igen/gen-semantics.h b/sim/igen/gen-semantics.h index 115251b2287a..daf5fc8ca2f9 100644 --- a/sim/igen/gen-semantics.h +++ b/sim/igen/gen-semantics.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_GEN_SEMANTICS_H +#define IGEN_GEN_SEMANTICS_H /* Creates the files semantics.[hc]. @@ -102,3 +104,5 @@ extern void print_semantic_body const insn_entry *instruction, const opcode_bits *expanded_bits, const insn_opcodes *opcodes); + +#endif /* IGEN_GEN_SEMANTICS_H */ diff --git a/sim/igen/gen-support.h b/sim/igen/gen-support.h index fac231ed96fe..c22a89565237 100644 --- a/sim/igen/gen-support.h +++ b/sim/igen/gen-support.h @@ -19,7 +19,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_GEN_SUPPORT_H +#define IGEN_GEN_SUPPORT_H extern void gen_support_h (lf *file, const insn_table *table); extern void gen_support_c (lf *file, const insn_table *table); + +#endif /* IGEN_GEN_SUPPORT_H */ diff --git a/sim/igen/gen.h b/sim/igen/gen.h index 53225bc84298..f6a77cf80a1a 100644 --- a/sim/igen/gen.h +++ b/sim/igen/gen.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_GEN_H +#define IGEN_GEN_H typedef struct _opcode_field opcode_field; struct _opcode_field @@ -214,3 +216,5 @@ extern void print_sim_engine_abort (lf *file, const char *message); extern void print_include (lf *file, igen_module module); extern void print_include_inline (lf *file, igen_module module); extern void print_includes (lf *file); + +#endif /* IGEN_GEN_H */ diff --git a/sim/igen/igen.h b/sim/igen/igen.h index eb5c755aeda6..cc3edac5a761 100644 --- a/sim/igen/igen.h +++ b/sim/igen/igen.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_IGEN_H +#define IGEN_IGEN_H /* code-generation options: */ @@ -249,3 +251,5 @@ do { \ options.gen.icache_size = 1024; \ options.warning = warning; \ } while (0) + +#endif /* IGEN_IGEN_H */ diff --git a/sim/igen/ld-cache.h b/sim/igen/ld-cache.h index 47bf9d60dae3..a7351cd765dd 100644 --- a/sim/igen/ld-cache.h +++ b/sim/igen/ld-cache.h @@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - +#ifndef IGEN_LD_CACHE_H +#define IGEN_LD_CACHE_H /* For backward compatibility only - load a standalone cache macro table */ @@ -64,3 +65,5 @@ extern cache_entry *load_cache_table (const char *file_name); + +#endif /* IGEN_LD_CACHE_H */ diff --git a/sim/igen/ld-decode.h b/sim/igen/ld-decode.h index 739e09e5d9e6..660f3a7ccd1a 100644 --- a/sim/igen/ld-decode.h +++ b/sim/igen/ld-decode.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_LD_DECODE_H +#define IGEN_LD_DECODE_H /* Instruction decode table: @@ -242,3 +244,5 @@ extern int decode_table_max_word_nr (const decode_table *rule); extern void dump_decode_rule (lf *file, const char *prefix, const decode_table *rule, const char *suffix); + +#endif /* IGEN_LD_DECODE_H */ diff --git a/sim/igen/ld-insn.h b/sim/igen/ld-insn.h index d22b855e1ce1..661cd40a0e85 100644 --- a/sim/igen/ld-insn.h +++ b/sim/igen/ld-insn.h @@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - +#ifndef IGEN_LD_INSN_H +#define IGEN_LD_INSN_H typedef uint64_t insn_uint; @@ -705,3 +706,5 @@ void dump_cache_entries void dump_insn_table (lf *file, const char *prefix, const insn_table *isa, const char *suffix); + +#endif /* IGEN_LD_INSN_H */ diff --git a/sim/igen/lf.h b/sim/igen/lf.h index d1e2acca5480..cea86d63db13 100644 --- a/sim/igen/lf.h +++ b/sim/igen/lf.h @@ -19,7 +19,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_LF_H +#define IGEN_LF_H + #include "ansidecl.h" +#include "misc.h" /* LF: Line Numbered Output Stream */ @@ -115,3 +119,5 @@ extern int lf_print__function_type_function (lf *file, print_function * print_type, const char *prefix, const char *trailing_space); + +#endif /* IGEN_LF_H */ diff --git a/sim/igen/misc.h b/sim/igen/misc.h index 45610558a262..04a7f720b41d 100644 --- a/sim/igen/misc.h +++ b/sim/igen/misc.h @@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - +#ifndef IGEN_MISC_H +#define IGEN_MISC_H /* Frustrating header junk */ @@ -102,3 +103,5 @@ name_map; extern int name2i (const char *name, const name_map * map); extern const char *i2name (const int i, const name_map * map); + +#endif /* IGEN_MISC_H */ diff --git a/sim/igen/table.h b/sim/igen/table.h index e6f318b4e36a..13429707f2e2 100644 --- a/sim/igen/table.h +++ b/sim/igen/table.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef IGEN_TABLE_H +#define IGEN_TABLE_H /* Read a table, line by line, from a file. @@ -138,3 +140,5 @@ extern char *skip_spaces (char *chp); extern char *skip_to_separator (char *chp, char *separators); extern char *back_spaces (char *start, char *chp); + +#endif /* IGEN_TABLE_H */