From patchwork Tue Jan 9 02:21:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83584 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 AB9C2385842C for ; Tue, 9 Jan 2024 02:22:00 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id CDC7C3858D38 for ; Tue, 9 Jan 2024 02:21:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CDC7C3858D38 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 CDC7C3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704766897; cv=none; b=OU07Xqd8jfbUXTSk3OHzPpEP39LXxcoBH8vxD4GR4410rhsVkzo1u223PGlRa11BarbG0rxbU9WSHWzlZCYqDFRIFXI4g5j/Gnme4wye9l7CpE2Yi7egYZcytDz6TThslHzncaTWGkEwZ6tv11EQuWnR/fkHq1x11pgUW1DjzOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704766897; c=relaxed/simple; bh=BWT68QOV5Ng0I/PMJPVo8dAMxa8vykESOfz8V9eUyLQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=FGb9FF6yD851CL5O50z1qKHcVio8D94bjcPDK9TBT/6klekn3CEUQ8cJAsT61UGg7t6wRNSfidRb90t84dN8r50iquT8QL8roruZZXteSFjYJmQd3SjvaQND2vRaQzymzxyMxgGvWUyrnrYZuDVHY+FJxjv/hjytg5oDm2oHwiM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 62F08343263; Tue, 9 Jan 2024 02:21:34 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed] sim: warnings: mark local funcs/vars as static Date: Mon, 8 Jan 2024 21:21:32 -0500 Message-ID: <20240109022132.11546-1-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, 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 These are only used in the respective files, so mark them as static. This fixes missing prototype warnings at build time. --- sim/m32c/opc2c.c | 28 +++++++++++----------- sim/m68hc11/gencode.c | 56 ++++++++++++++++--------------------------- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/sim/m32c/opc2c.c b/sim/m32c/opc2c.c index 113e39072abe..9e84446d9950 100644 --- a/sim/m32c/opc2c.c +++ b/sim/m32c/opc2c.c @@ -58,9 +58,9 @@ typedef struct VaryRef *vary; } opcode; -int n_opcodes; -opcode **opcodes; -opcode *op; +static int n_opcodes; +static opcode **opcodes; +static opcode *op; typedef struct { @@ -71,17 +71,17 @@ typedef struct unsigned char *patterns; } Vary; -Vary **vary = 0; -int n_varies = 0; +static Vary **vary = 0; +static int n_varies = 0; -unsigned char cur_bits[MAX_BYTES + 1]; +static unsigned char cur_bits[MAX_BYTES + 1]; -char *orig_filename; +static char *orig_filename; -FILE *sim_log = 0; +static FILE *sim_log = 0; #define lprintf if (sim_log) fprintf -opcode prefix_text, suffix_text; +static opcode prefix_text, suffix_text; typedef enum { @@ -101,7 +101,7 @@ typedef struct Indirect } u; } Indirect; -Indirect indirect[256]; +static Indirect indirect[256]; static int next_varybits (int bits, opcode * op, int byte) @@ -157,7 +157,7 @@ valid_varybits (int bits, opcode * op, int byte) return 1; } -char * +static char * prmb (int mask, int bits) { static char buf[8][30]; @@ -195,7 +195,7 @@ op_cmp (const void *va, const void *vb) return strcmp (a->id, b->id); } -void +static void dump_lines (opcode * op, int level, Indirect * ind) { char *varnames[40]; @@ -289,7 +289,7 @@ dump_lines (opcode * op, int level, Indirect * ind) printf ("%*s}\n", level, ""); } -void +static void store_opcode_bits (opcode * op, int byte, Indirect * ind) { int bits = op->b[byte].decodable_bits; @@ -335,7 +335,7 @@ store_opcode_bits (opcode * op, int byte, Indirect * ind) while ((bits = next_varybits (bits, op, byte)) != 0); } -void +static void emit_indirect (Indirect * ind, int byte) { int unsup = 0; diff --git a/sim/m68hc11/gencode.c b/sim/m68hc11/gencode.c index 4e507701b9d0..ecd8f7bbf4f3 100644 --- a/sim/m68hc11/gencode.c +++ b/sim/m68hc11/gencode.c @@ -89,7 +89,7 @@ struct m6811_opcode_pattern * Size -----------------+ +--------------- Min # cycles * +-------------------- Opcode */ -struct m6811_opcode_pattern m6811_opcode_patterns[] = { +static struct m6811_opcode_pattern m6811_opcode_patterns[] = { /* Move 8 and 16 bits. We need two implementations: one that sets the flags and one that preserve them. */ { "movtst8", "dst8 = src8", "cpu_ccr_update_tst8 (cpu, dst8)" }, @@ -358,7 +358,7 @@ struct m6811_opcode_def * (y)->a src8 = (IND, Y) a = dst8 * ()->b src8 = (EXT) b = dst8 */ -struct m6811_opcode_def m6811_page1_opcodes[] = { +static struct m6811_opcode_def m6811_page1_opcodes[] = { { "test", 0, 0, 1, 0x00, 5, _M, CHG_NONE }, { "nop", 0, 0, 1, 0x01, 2, 2, CHG_NONE }, { "idiv", "x,d->x", "idiv16", 1, 0x02, 3, 41, CLR_V_CHG_ZC}, @@ -612,7 +612,7 @@ struct m6811_opcode_def m6811_page1_opcodes[] = { * Pattern -----------+ +--------------- Min # cycles * Size -----------------+ +-------------------- Opcode */ -struct m6811_opcode_def m6811_page2_opcodes[] = { +static struct m6811_opcode_def m6811_page2_opcodes[] = { { "iny", "y->y", "inc16", 2, 0x08, 4, 4, CHG_Z }, { "dey", "y->y", "dec16", 2, 0x09, 4, 4, CHG_Z }, { "bset", "(y),#->(y)","or8", 4, 0x1c, 8, 8, CLR_V_CHG_NZ }, @@ -687,7 +687,7 @@ struct m6811_opcode_def m6811_page2_opcodes[] = { * Pattern -----------+ +--------------- Min # cycles * Size -----------------+ +-------------------- Opcode */ -struct m6811_opcode_def m6811_page3_opcodes[] = { +static struct m6811_opcode_def m6811_page3_opcodes[] = { { "cmpd", "#,d", "sub16", 4, 0x83, 5, 5, CHG_NZVC }, { "cmpd", "*,d", "sub16", 3, 0x93, 6, 6, CHG_NZVC }, { "cmpd", "(x),d", "sub16", 3, 0xa3, 7, 7, CHG_NZVC }, @@ -705,7 +705,7 @@ struct m6811_opcode_def m6811_page3_opcodes[] = { * Pattern -----------+ +--------------- Min # cycles * Size -----------------+ +-------------------- Opcode */ -struct m6811_opcode_def m6811_page4_opcodes[] = { +static struct m6811_opcode_def m6811_page4_opcodes[] = { { "syscall", "", "syscall", 2, 0x03, 6, 6, CHG_NONE }, { "cmpd", "(y),d", "sub16", 3, 0xa3, 7, 7, CHG_NZVC }, { "cmpx", "(y),x", "sub16", 3, 0xac, 7, 7, CHG_NZVC }, @@ -721,7 +721,7 @@ struct m6811_opcode_def m6811_page4_opcodes[] = { * Pattern -----------+ +--------------- Min # cycles * Size -----------------+ +-------------------- Opcode */ -struct m6811_opcode_def m6812_page1_opcodes[] = { +static struct m6811_opcode_def m6812_page1_opcodes[] = { { "adca", "#,a->a", "adc8", 2, 0x89, 1, 1, CHG_HNZVC }, { "adca", "*,a->a", "adc8", 2, 0x99, 3, 3, CHG_HNZVC }, { "adca", "(),a->a", "adc8", 3, 0xb9, 3, 3, CHG_HNZVC }, @@ -1070,7 +1070,7 @@ struct m6811_opcode_def m6812_page1_opcodes[] = { { "wai", 0, 0, 1, 0x3e, 8, _M, CHG_NONE } }; -struct m6811_opcode_def m6812_page2_opcodes[] = { +static struct m6811_opcode_def m6812_page2_opcodes[] = { { "cba", "b,a", "sub8", 2, 0x17, 2, 2, CHG_NZVC }, /* After 'daa', the Z flag is undefined. Mark it as changed. */ @@ -1138,27 +1138,13 @@ struct m6811_opcode_def m6812_page2_opcodes[] = { { "wav", 0, 0, 2, 0x3c, 8, _M, SET_Z_CHG_HNVC } }; -void fatal_error (const struct m6811_opcode_def*, const char*, ...); -void print (FILE*, int, const char*,...); -int gen_fetch_operands (FILE*, int, const struct m6811_opcode_def*, - const char*); -void gen_save_result (FILE*, int, const struct m6811_opcode_def*, - int, const char*); -const struct m6811_opcode_pattern* -find_opcode_pattern (const struct m6811_opcode_def*); -void gen_interp (FILE*, int, const struct m6811_opcode_def*); -void gen_interpreter_for_table (FILE*, int, - const struct m6811_opcode_def*, - int, const char*); -void gen_interpreter (FILE*); - static int indent_level = 2; static int current_insn_size = 0; /* Fatal error message and exit. This method is called when an inconsistency is detected in the generation table. */ -void +static void fatal_error (const struct m6811_opcode_def *opcode, const char *msg, ...) { va_list argp; @@ -1180,7 +1166,7 @@ fatal_error (const struct m6811_opcode_def *opcode, const char *msg, ...) /* Format and pretty print for the code generation. (printf like format). */ -void +static void print (FILE *fp, int col, const char *msg, ...) { va_list argp; @@ -1292,7 +1278,7 @@ print (FILE *fp, int col, const char *msg, ...) addr = fetch_relbranch (cpu) <- Final 'addr' Returns 1 if the 'addr' operand is set, 0 otherwise. */ -int +static int gen_fetch_operands (FILE *fp, int col, const struct m6811_opcode_def *opcode, const char *operand_size) @@ -1608,7 +1594,7 @@ gen_fetch_operands (FILE *fp, int col, [] 68HC12 indexed indirect (sp) Push Push the 8/16-bits result on the stack. */ -void +static void gen_save_result (FILE *fp, int col, const struct m6811_opcode_def *opcode, int addr_set, @@ -1804,7 +1790,7 @@ gen_save_result (FILE *fp, int col, /* Find the instruction pattern for a given instruction. */ -const struct m6811_opcode_pattern* +static const struct m6811_opcode_pattern* find_opcode_pattern (const struct m6811_opcode_def *opcode) { int i; @@ -1826,7 +1812,7 @@ find_opcode_pattern (const struct m6811_opcode_def *opcode) } /* Generate the code for interpretation of instruction 'opcode'. */ -void +static void gen_interp (FILE *fp, int col, const struct m6811_opcode_def *opcode) { const char *operands = opcode->operands; @@ -1885,7 +1871,7 @@ gen_interp (FILE *fp, int col, const struct m6811_opcode_def *opcode) /* Generate the interpretor for a given 68HC11 page set. */ -void +static void gen_interpreter_for_table (FILE *fp, int col, const struct m6811_opcode_def *table, int size, @@ -1930,7 +1916,7 @@ gen_interpreter_for_table (FILE *fp, int col, /* Generate the table of instruction cycle. These tables are indexed by the opcode number to allow a fast cycle time computation. */ -void +static void gen_cycle_table (FILE *fp, const char *name, const struct m6811_opcode_def *table, int size) @@ -1986,7 +1972,7 @@ gen_cycle_table (FILE *fp, const char *name, #define USE_SRC8 1 #define USE_DST8 2 -void +static void gen_function_entry (FILE *fp, const char *name, int locals) { /* Generate interpretor entry point. */ @@ -2002,13 +1988,13 @@ gen_function_entry (FILE *fp, const char *name, int locals) print (fp, indent_level, "uint8_t dst8;\n"); } -void +static void gen_function_close (FILE *fp) { print (fp, 0, "}\n"); } -int +static int cmp_opcode (const void *e1, const void *e2) { struct m6811_opcode_def* op1 = (struct m6811_opcode_def*) e1; @@ -2017,7 +2003,7 @@ cmp_opcode (const void *e1, const void *e2) return (int) (op1->insn_code) - (int) (op2->insn_code); } -void +static void prepare_table (struct m6811_opcode_def* table, int size) { int i; @@ -2033,7 +2019,7 @@ prepare_table (struct m6811_opcode_def* table, int size) } } -void +static void gen_interpreter (FILE *fp) { int col = 0; @@ -2119,7 +2105,7 @@ gen_interpreter (FILE *fp) } } -void +static void usage (char* prog) { fprintf (stderr, "Usage: %s {-m6811|-m6812}\n", prog);