From de64951a2d4ed29b4c459c87fb9f84af0b509e82 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 9 Oct 2001 08:24:22 +0000 Subject: [PATCH] Fix compile time warning messages in generated C files --- ChangeLog | 12 ++++++++++++ cpu/fr30.opc | 38 ++++++++++++++++++++++++++++++++------ cpu/m32r.opc | 32 ++++++++++++++++++++++---------- cpu/openrisc.opc | 22 ++++++++++++---------- desc-cpu.scm | 9 +++++++++ opc-asmdis.scm | 13 ++++++++++--- opc-ibld.scm | 29 +++++++++++++++++++++++------ opc-itab.scm | 8 +++++--- 8 files changed, 125 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7221faa..4fa56ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2001-10-08 Nick Clifton + + * desc-cpu.scm: Add missing function prototypes (for generated + C files). Fix compile time warning messages about unused + parameters (for generated C files). + * opc-asmdis.scm: The same. + * opc-ibld.c: The same. + * opc-itab.scm: The same. + * cpu/fr30.opc: The same. + * cpu/m32r.opc: The same. + * cpu/openrisc.opc: The same. + 2001-07-12 Jeff Johnston * opc-itab.scm (@arch@_cgen_init_opcode_table): Unconditionally diff --git a/cpu/fr30.opc b/cpu/fr30.opc index a30cb0a..1c5645b 100644 --- a/cpu/fr30.opc +++ b/cpu/fr30.opc @@ -1,5 +1,5 @@ /* FR30 opcode support. -*- C -*- - Copyright (C) 2000 Red Hat, Inc. + Copyright (C) 2000, 2001 Red Hat, Inc. This file is part of CGEN. */ /* This file is an addendum to fr30.cpu. Heavy use of C code isn't @@ -29,7 +29,20 @@ /* -- */ /* -- asm.c */ -/* Handle register lists for LDMx and STMx */ +/* Handle register lists for LDMx and STMx. */ + +static int parse_register_number + PARAMS ((const char **)); +static const char * parse_register_list + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *, int, int)); +static const char * parse_low_register_list_ld + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi_register_list_ld + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_low_register_list_st + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi_register_list_st + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); static int parse_register_number (strp) @@ -37,7 +50,7 @@ parse_register_number (strp) { int regno; if (**strp < '0' || **strp > '9') - return -1; /* error */ + return -1; /* error. */ regno = **strp - '0'; ++*strp; @@ -52,14 +65,15 @@ parse_register_number (strp) static const char * parse_register_list (cd, strp, opindex, valuep, high_low, load_store) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; const char **strp; - int opindex; + int opindex ATTRIBUTE_UNUSED; unsigned long *valuep; int high_low; /* 0 == high, 1 == low */ int load_store; /* 0 == load, 1 == store */ { int regno; + *valuep = 0; while (**strp && **strp != ')') { @@ -78,7 +92,7 @@ parse_register_list (cd, strp, opindex, valuep, high_low, load_store) if (high_low) regno -= 8; - if (load_store) /* mask is reversed for store */ + if (load_store) /* Mask is reversed for store. */ *valuep |= 0x80 >> regno; else *valuep |= 1 << regno; @@ -140,6 +154,18 @@ parse_hi_register_list_st (cd, strp, opindex, valuep) /* -- */ /* -- dis.c */ +static void print_register_list + PARAMS ((PTR, long, long, int)); +static void print_hi_register_list_ld + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_low_register_list_ld + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_hi_register_list_st + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_low_register_list_st + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_m4 + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); static void print_register_list (dis_info, value, offset, load_store) diff --git a/cpu/m32r.opc b/cpu/m32r.opc index 601ca58..a7c5f38 100644 --- a/cpu/m32r.opc +++ b/cpu/m32r.opc @@ -1,5 +1,5 @@ /* M32R opcode support. -*- C -*- - Copyright (C) 2000 Red Hat, Inc. + Copyright (C) 2000, 2001 Red Hat, Inc. This file is part of CGEN. */ /* This file is an addendum to m32r.cpu. Heavy use of C code isn't @@ -34,15 +34,23 @@ /* -- */ /* -- asm.c */ +static const char * parse_hash + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_slo16 + PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_ulo16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); /* Handle '#' prefixes (i.e. skip over them). */ static const char * parse_hash (cd, strp, opindex, valuep) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; const char **strp; - int opindex; - unsigned long *valuep; + int opindex ATTRIBUTE_UNUSED; + unsigned long *valuep ATTRIBUTE_UNUSED; { if (**strp == '#') ++*strp; @@ -184,14 +192,18 @@ parse_ulo16 (cd, strp, opindex, valuep) /* -- */ /* -- dis.c */ +static void print_hash PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static int my_print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); /* Immediate values are prefixed with '#'. */ -#define CGEN_PRINT_NORMAL(cd, info, value, attrs, pc, length) \ -do { \ - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_HASH_PREFIX)) \ - (*info->fprintf_func) (info->stream, "#"); \ -} while (0) +#define CGEN_PRINT_NORMAL(cd, info, value, attrs, pc, length) \ + do \ + { \ + if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_HASH_PREFIX)) \ + (*info->fprintf_func) (info->stream, "#"); \ + } \ + while (0) /* Handle '#' prefixes as operands. */ @@ -208,7 +220,7 @@ print_hash (cd, dis_info, value, attrs, pc, length) (*info->fprintf_func) (info->stream, "#"); } -#undef CGEN_PRINT_INSN +#undef CGEN_PRINT_INSN #define CGEN_PRINT_INSN my_print_insn static int diff --git a/cpu/openrisc.opc b/cpu/openrisc.opc index 621db0e..4b6b0d7 100644 --- a/cpu/openrisc.opc +++ b/cpu/openrisc.opc @@ -20,11 +20,12 @@ */ /* -- opc.h */ -#undef CGEN_DIS_HASH_SIZE +#undef CGEN_DIS_HASH_SIZE #define CGEN_DIS_HASH_SIZE 64 -#undef CGEN_DIS_HASH +#undef CGEN_DIS_HASH #define CGEN_DIS_HASH(buffer, value) (((unsigned char *) (buffer))[0] >> 2) +extern long openrisc_sign_extend_16bit PARAMS ((long)); /* -- */ /* -- opc.c */ @@ -34,6 +35,11 @@ #define CGEN_VERBOSE_ASSEMBLER_ERRORS +static const char * parse_hi16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_lo16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); + long openrisc_sign_extend_16bit (value) long value; @@ -41,7 +47,6 @@ openrisc_sign_extend_16bit (value) return (long) (short) value; } - /* Handle hi(). */ static const char * @@ -85,14 +90,13 @@ parse_hi16 (cd, strp, opindex, valuep) if (**strp == '-') errmsg = cgen_parse_signed_integer (cd, strp, opindex, (long *) &value); else - errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value); + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, (unsigned long *) &value); } *valuep = (long) (short) (value & 0xffff); return errmsg; } - -/* Handle lo() */ +/* Handle lo(). */ static const char * parse_lo16 (cd, strp, opindex, valuep) @@ -135,7 +139,7 @@ parse_lo16 (cd, strp, opindex, valuep) if (**strp == '-') errmsg = cgen_parse_signed_integer (cd, strp, opindex, (long *) &value); else - errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value); + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, (unsigned long *) &value); *valuep = (long) (short) (value & 0xffff); return errmsg; } @@ -143,8 +147,6 @@ parse_lo16 (cd, strp, opindex, valuep) /* -- */ /* -- ibd.h */ -extern openrisc_sign_extend_16bit (long); +extern long openrisc_sign_extend_16bit PARAMS ((long)); /* -- */ - - diff --git a/desc-cpu.scm b/desc-cpu.scm index 79959c2..0916d47 100644 --- a/desc-cpu.scm +++ b/desc-cpu.scm @@ -527,6 +527,14 @@ static const CGEN_IBASE @arch@_cgen_insn_table[MAX_INSNS] = (define (-gen-cpu-open) (string-append "\ +static const CGEN_MACH * lookup_mach_via_bfd_name + PARAMS ((const CGEN_MACH *, const char *)); +static void build_hw_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_ifield_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_operand_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_insn_table PARAMS ((CGEN_CPU_TABLE *)); +static void @arch@_cgen_rebuild_tables PARAMS ((CGEN_CPU_TABLE *)); + /* Subroutine of @arch@_cgen_cpu_open to look up a mach via its bfd name. */ static const CGEN_MACH * @@ -864,6 +872,7 @@ void (string-append "\ /* Initialize anything needed to be done once, before any cpu_open call. */ +static void init_tables PARAMS ((void)); static void init_tables () diff --git a/opc-asmdis.scm b/opc-asmdis.scm index d3a441c..7d3aeeb 100644 --- a/opc-asmdis.scm +++ b/opc-asmdis.scm @@ -1,5 +1,5 @@ ; Assembler/disassembler support generator. -; Copyright (C) 2000 Red Hat, Inc. +; Copyright (C) 2000, 2001 Red Hat, Inc. ; This file is part of CGEN. ; Assembler support. @@ -8,6 +8,9 @@ (logit 2 "Generating parse switch ...\n") (string-list "\ +const char * @arch@_cgen_parse_operand + PARAMS ((CGEN_CPU_DESC, int, const char **, CGEN_FIELDS *)); + /* Main entry point for operand parsing. This function is basically just a big switch statement. Earlier versions @@ -31,7 +34,7 @@ const char * { const char * errmsg = NULL; /* Used by scalar operands that still need to be parsed. */ - " (gen-ifield-default-type) " junk; + " (gen-ifield-default-type) " junk ATTRIBUTE_UNUSED; switch (opindex) { @@ -97,6 +100,10 @@ void (logit 2 "Generating print switch ...\n") (string-list "\ +void @arch@_cgen_print_operand + PARAMS ((CGEN_CPU_DESC, int, PTR, CGEN_FIELDS *, + void const *, bfd_vma, int)); + /* Main entry point for printing operands. XINFO is a `void *' and not a `disassemble_info *' to not put a requirement of dis-asm.h on cgen.h. @@ -119,7 +126,7 @@ void int opindex; PTR xinfo; CGEN_FIELDS *fields; - void const *attrs; + void const *attrs ATTRIBUTE_UNUSED; bfd_vma pc; int length; { diff --git a/opc-ibld.scm b/opc-ibld.scm index 0795187..54b8438 100644 --- a/opc-ibld.scm +++ b/opc-ibld.scm @@ -1,5 +1,5 @@ ; Instruction builder support. -; Copyright (C) 2000 Red Hat, Inc. +; Copyright (C) 2000, 2001 Red Hat, Inc. ; This file is part of CGEN. ; Instruction field support. @@ -8,6 +8,11 @@ (logit 2 "Generating field get switch ...\n") (string-list "\ +int @arch@_cgen_get_int_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); +bfd_vma @arch@_cgen_get_vma_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); + /* Getting values from cgen_fields is handled by a collection of functions. They are distinguished by the type of the VALUE argument they return. TODO: floating point, inlining support, remove cases where result type @@ -15,7 +20,7 @@ int @arch@_cgen_get_int_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -38,7 +43,7 @@ int bfd_vma @arch@_cgen_get_vma_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -65,6 +70,11 @@ bfd_vma (logit 2 "Generating field set switch ...\n") (string-list "\ +void @arch@_cgen_set_int_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, int)); +void @arch@_cgen_set_vma_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma)); + /* Stuffing values in cgen_fields is handled by a collection of functions. They are distinguished by the type of the VALUE argument they accept. TODO: floating point, inlining support, remove cases where argument type @@ -72,7 +82,7 @@ bfd_vma void @arch@_cgen_set_int_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; int value; @@ -92,7 +102,7 @@ void void @arch@_cgen_set_vma_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; bfd_vma value; @@ -161,6 +171,9 @@ void (logit 2 "Generating insert switch ...\n") (string-list "\ +const char * @arch@_cgen_insert_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma)); + /* Main entry point for operand insertion. This function is basically just a big switch statement. Earlier versions @@ -182,7 +195,7 @@ const char * int opindex; CGEN_FIELDS * fields; CGEN_INSN_BYTES_PTR buffer; - bfd_vma pc; + bfd_vma pc ATTRIBUTE_UNUSED; { const char * errmsg = NULL; unsigned int total_length = CGEN_FIELDS_BITSIZE (fields); @@ -207,6 +220,10 @@ const char * (logit 2 "Generating extract switch ...\n") (string-list "\ +int @arch@_cgen_extract_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, + CGEN_FIELDS *, bfd_vma)); + /* Main entry point for operand extraction. The result is <= 0 for error, >0 for success. ??? Actual values aren't well defined right now. diff --git a/opc-itab.scm b/opc-itab.scm index 2b0bbbb..ba106ec 100644 --- a/opc-itab.scm +++ b/opc-itab.scm @@ -409,7 +409,7 @@ static const CGEN_OPCODE @arch@_cgen_insn_opcode_table[MAX_INSNS] = static int asm_hash_insn_p (insn) - const CGEN_INSN *insn; + const CGEN_INSN *insn ATTRIBUTE_UNUSED; { return CGEN_ASM_HASH_P (insn); } @@ -459,8 +459,8 @@ asm_hash_insn (mnem) static unsigned int dis_hash_insn (buf, value) - const char * buf; - CGEN_INSN_INT value; + const char * buf ATTRIBUTE_UNUSED; + CGEN_INSN_INT value ATTRIBUTE_UNUSED; { return CGEN_DIS_HASH (buf, value); } @@ -624,6 +624,8 @@ static const CGEN_OPCODE @arch@_cgen_macro_insn_opcode_table[] = (define (-gen-opcode-init-fn) (string-write "\ +static void set_fields_bitsize PARAMS ((CGEN_FIELDS *, int)); + /* Set the recorded length of the insn in the CGEN_FIELDS struct. */ static void -- 2.43.5