This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gcc-3_4-basic-improvements-branch] Patch installed for various warnings
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 14 Sep 2002 15:28:25 -0400 (EDT)
- Subject: [gcc-3_4-basic-improvements-branch] Patch installed for various warnings
The patch below fixes these (target specific) warnings:
> c-lex.c:236: warning: unused variable `value'
> collect2.c:2932: warning: `ignore_library' defined but not used
> config/m68hc11/m68hc11.c:2666: warning: function declaration isn't a prototype
> config/m68hc11/m68hc11.c:2683: warning: function declaration isn't a prototype
> config/m68hc11/m68hc11.c:67: warning: `m68hc11_autoinc_compatible_p' declared `static' but never defined
> config/m88k/m88k.c:895: warning: unused variable `high'
> config/m88k/m88k.c:895: warning: unused variable `low'
> final.c:4046: warning: initialization discards qualifiers from pointer target type
> insn-emit.c:12749: warning: unused variable `val'
> insn-output.c:1892: warning: initialization discards qualifiers from pointer target type
> regrename.c:1333: warning: unused parameter `copy_regno'
> reload.c:5624: warning: unused variable `regno'
> reload.c:672: warning: unused parameter `dest_regno'
> reload.c:678: warning: unused variable `dest_class'
> varasm.c:1789: warning: assignment discards qualifiers from pointer target type
> varasm.c:4492: warning: unused variable `name'
Tested by cross-compiling cc1 to the following targets:
alpha-dec-osf4.0 arc-unknown-elf arm-unknown-pe avr-unknown-elf
c4x-unknown-rtems cris-unknown-linux-gnu d30v-unknown-elf
dsp16xx-unknown-elf fr30-unknown-elf frv-unknown-elf
h8300-unknown-rtems hppa1.1-hp-hpux11 i370-unknown-linux-gnu
i686-pc-linux-gnu i960-wrs-vxworks ia64-unknown-linux-gnu
ip2k-unknown-elf m32r-unknown-elf m68hc11-unknown-elf
m68k-motorola-sysv m88k-unknown-openbsd mcore-unknown-elf
mips-sgi-irix6.5 mmix-knuth-mmixware mn10200-unknown-elf
mn10300-unknown-elf ns32k-unknown-netbsd pdp11-unknown-bsd
powerpc-apple-darwin rs6000-ibm-aix4.3.3.0 s390-unknown-linux-gnu
sh-unknown-rtems sparc-sun-sunos4.1.4 v850-unknown-rtems
vax-unknown-ultrix xstormy16-unknown-elf xtensa-unknown-elf
Installed as obvious.
2002-09-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-lex.c (cb_ident): Mark variable with ATTRIBUTE_UNUSED.
* collect2.c (ignore_library, aix_std_libs): Move into the context
where it is used.
* m68hc11.c (m68hc11_autoinc_compatible_p): Delete prototype.
(autoinc_mode, m68hc11_make_autoinc_notes): Add prototypes.
* m88k.c (output_call): Wrap variables with macro controlling use.
* rs6000.md: Likewise. Const-ify variable.
* sh.h (ASM_OUTPUT_LABELREF): Likewise.
* final.c (only_leaf_regs_used): Likewise.
* regrename.c (maybe_mode_change): Mark parameter with
ATTRIBUTE_UNUSED.
* reload.c (find_valid_class): Likewise. Likewise for variable.
(find_reloads_address_1): Likewise.
* varasm.c (weak_finish): Wrap variable with macro controlling use.
diff -rup orig/egcc-bib-CVS20020901/gcc/c-lex.c egcc-bib-CVS20020901/gcc/c-lex.c
--- orig/egcc-bib-CVS20020901/gcc/c-lex.c 2002-08-12 02:02:53.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/c-lex.c 2002-09-02 15:33:48.251116898 -0400
@@ -233,7 +233,7 @@ cb_ident (pfile, line, str)
if (! flag_no_ident)
{
/* Convert escapes in the string. */
- tree value = lex_string (str->text, str->len, 0);
+ tree value ATTRIBUTE_UNUSED = lex_string (str->text, str->len, 0);
ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (value));
}
#endif
diff -rup orig/egcc-bib-CVS20020901/gcc/collect2.c egcc-bib-CVS20020901/gcc/collect2.c
--- orig/egcc-bib-CVS20020901/gcc/collect2.c 2002-08-04 18:45:18.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/collect2.c 2002-09-02 12:09:16.380608328 -0400
@@ -303,7 +303,6 @@ static int is_in_list PARAMS ((const ch
#endif
static void write_aix_file PARAMS ((FILE *, struct id *));
static char *resolve_lib_name PARAMS ((const char *));
-static int ignore_library PARAMS ((const char *));
#endif
static char *extract_string PARAMS ((const char **));
@@ -2687,6 +2686,41 @@ scan_libraries (prog_name)
#endif
+#ifdef COLLECT_EXPORT_LIST
+/* Array of standard AIX libraries which should not
+ be scanned for ctors/dtors. */
+static const char *const aix_std_libs[] = {
+ "/unix",
+ "/lib/libc.a",
+ "/lib/libm.a",
+ "/lib/libc_r.a",
+ "/lib/libm_r.a",
+ "/usr/lib/libc.a",
+ "/usr/lib/libm.a",
+ "/usr/lib/libc_r.a",
+ "/usr/lib/libm_r.a",
+ "/usr/lib/threads/libc.a",
+ "/usr/ccs/lib/libc.a",
+ "/usr/ccs/lib/libm.a",
+ "/usr/ccs/lib/libc_r.a",
+ "/usr/ccs/lib/libm_r.a",
+ NULL
+};
+
+/* This function checks the filename and returns 1
+ if this name matches the location of a standard AIX library. */
+static int ignore_library PARAMS ((const char *));
+static int
+ignore_library (name)
+ const char *name;
+{
+ const char *const *p = &aix_std_libs[0];
+ while (*p++ != NULL)
+ if (! strcmp (name, *p)) return 1;
+ return 0;
+}
+#endif /* COLLECT_EXPORT_LIST */
+
extern char *ldgetname ();
/* COFF version to scan the name list of the loaded program for
@@ -2906,38 +2940,6 @@ if (debug) fprintf (stderr, "found: %s\n
fatal ("library lib%s not found", name);
return (NULL);
}
-
-/* Array of standard AIX libraries which should not
- be scanned for ctors/dtors. */
-static const char *const aix_std_libs[] = {
- "/unix",
- "/lib/libc.a",
- "/lib/libm.a",
- "/lib/libc_r.a",
- "/lib/libm_r.a",
- "/usr/lib/libc.a",
- "/usr/lib/libm.a",
- "/usr/lib/libc_r.a",
- "/usr/lib/libm_r.a",
- "/usr/lib/threads/libc.a",
- "/usr/ccs/lib/libc.a",
- "/usr/ccs/lib/libm.a",
- "/usr/ccs/lib/libc_r.a",
- "/usr/ccs/lib/libm_r.a",
- NULL
-};
-
-/* This function checks the filename and returns 1
- if this name matches the location of a standard AIX library. */
-static int
-ignore_library (name)
- const char *name;
-{
- const char *const *p = &aix_std_libs[0];
- while (*p++ != NULL)
- if (! strcmp (name, *p)) return 1;
- return 0;
-}
#endif /* COLLECT_EXPORT_LIST */
diff -rup orig/egcc-bib-CVS20020901/gcc/config/m68hc11/m68hc11.c egcc-bib-CVS20020901/gcc/config/m68hc11/m68hc11.c
--- orig/egcc-bib-CVS20020901/gcc/config/m68hc11/m68hc11.c 2002-08-20 19:27:02.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/config/m68hc11/m68hc11.c 2002-09-02 10:30:32.492652985 -0400
@@ -64,7 +64,6 @@ static int go_if_legitimate_address_inte
int));
static int register_indirect_p PARAMS((rtx, enum machine_mode, int));
static rtx m68hc11_expand_compare PARAMS((enum rtx_code, rtx, rtx));
-static int m68hc11_autoinc_compatible_p PARAMS ((rtx, rtx));
static int must_parenthesize PARAMS ((rtx));
static int m68hc11_shift_cost PARAMS ((enum machine_mode, rtx, int));
static int m68hc11_auto_inc_p PARAMS ((rtx));
@@ -78,6 +77,8 @@ static void m68hc11_output_function_epil
static void m68hc11_asm_out_constructor PARAMS ((rtx, int));
static void m68hc11_asm_out_destructor PARAMS ((rtx, int));
static void m68hc11_encode_section_info PARAMS((tree, int));
+static int autoinc_mode PARAMS((rtx));
+static int m68hc11_make_autoinc_notes PARAMS((rtx *, void *));
rtx m68hc11_soft_tmp_reg;
diff -rup orig/egcc-bib-CVS20020901/gcc/config/m88k/m88k.c egcc-bib-CVS20020901/gcc/config/m88k/m88k.c
--- orig/egcc-bib-CVS20020901/gcc/config/m88k/m88k.c 2002-09-01 22:46:04.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/config/m88k/m88k.c 2002-09-02 10:33:24.763268725 -0400
@@ -899,7 +899,9 @@ output_call (operands, addr)
jump = XVECEXP (final_sequence, 0, 1);
if (GET_CODE (jump) == JUMP_INSN)
{
+#ifndef USE_GAS
rtx low, high;
+#endif
const char *last;
rtx dest = XEXP (SET_SRC (PATTERN (jump)), 0);
int delta = 4 * (INSN_ADDRESSES (INSN_UID (dest))
diff -rup orig/egcc-bib-CVS20020901/gcc/config/rs6000/rs6000.md egcc-bib-CVS20020901/gcc/config/rs6000/rs6000.md
--- orig/egcc-bib-CVS20020901/gcc/config/rs6000/rs6000.md 2002-08-19 12:32:54.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/config/rs6000/rs6000.md 2002-09-02 15:48:43.767203977 -0400
@@ -8460,7 +8460,9 @@
int endian = (WORDS_BIG_ENDIAN == 0);
long l[2];
REAL_VALUE_TYPE rv;
+#if HOST_BITS_PER_WIDE_INT >= 64
HOST_WIDE_INT val;
+#endif
REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
@@ -10183,7 +10185,7 @@
"*
{
#if TARGET_MACHO
- char *picbase = machopic_function_base_name ();
+ const char *const picbase = machopic_function_base_name ();
operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1));
#endif
return \"bcl 20,31,%1\\n%1:\";
diff -rup orig/egcc-bib-CVS20020901/gcc/config/sh/sh.h egcc-bib-CVS20020901/gcc/config/sh/sh.h
--- orig/egcc-bib-CVS20020901/gcc/config/sh/sh.h 2002-07-30 22:13:34.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/config/sh/sh.h 2002-09-02 15:51:04.655892661 -0400
@@ -2972,7 +2972,7 @@ while (0)
#define ASM_OUTPUT_LABELREF(FILE, NAME) \
do \
{ \
- char * lname; \
+ const char * lname; \
\
STRIP_DATALABEL_ENCODING (lname, (NAME)); \
if (lname[0] == '*') \
diff -rup orig/egcc-bib-CVS20020901/gcc/final.c egcc-bib-CVS20020901/gcc/final.c
--- orig/egcc-bib-CVS20020901/gcc/final.c 2002-09-01 22:46:07.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/final.c 2002-09-02 09:04:54.757542982 -0400
@@ -4043,7 +4043,7 @@ int
only_leaf_regs_used ()
{
int i;
- char *permitted_reg_in_leaf_functions = LEAF_REGISTERS;
+ const char *const permitted_reg_in_leaf_functions = LEAF_REGISTERS;
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if ((regs_ever_live[i] || global_regs[i])
diff -rup orig/egcc-bib-CVS20020901/gcc/regrename.c egcc-bib-CVS20020901/gcc/regrename.c
--- orig/egcc-bib-CVS20020901/gcc/regrename.c 2002-08-21 19:24:10.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/regrename.c 2002-09-02 15:35:55.660020635 -0400
@@ -1330,7 +1330,7 @@ mode_change_ok (orig_mode, new_mode, reg
static rtx
maybe_mode_change (orig_mode, copy_mode, new_mode, regno, copy_regno)
enum machine_mode orig_mode, copy_mode, new_mode;
- unsigned int regno, copy_regno;
+ unsigned int regno, copy_regno ATTRIBUTE_UNUSED;
{
if (orig_mode == new_mode)
return gen_rtx_raw_REG (new_mode, regno);
diff -rup orig/egcc-bib-CVS20020901/gcc/reload.c egcc-bib-CVS20020901/gcc/reload.c
--- orig/egcc-bib-CVS20020901/gcc/reload.c 2002-08-15 13:44:10.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/reload.c 2002-09-02 15:37:42.727611033 -0400
@@ -669,13 +669,13 @@ static enum reg_class
find_valid_class (m1, n, dest_regno)
enum machine_mode m1 ATTRIBUTE_UNUSED;
int n;
- unsigned int dest_regno;
+ unsigned int dest_regno ATTRIBUTE_UNUSED;
{
int best_cost = -1;
int class;
int regno;
enum reg_class best_class = NO_REGS;
- enum reg_class dest_class = REGNO_REG_CLASS (dest_regno);
+ enum reg_class dest_class ATTRIBUTE_UNUSED = REGNO_REG_CLASS (dest_regno);
unsigned int best_size = 0;
int cost;
@@ -5621,7 +5621,7 @@ find_reloads_address_1 (mode, x, context
needless copies if SUBREG_REG is multi-word. */
if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
{
- int regno = subreg_regno (x);
+ int regno ATTRIBUTE_UNUSED = subreg_regno (x);
if (! (context ? REGNO_OK_FOR_INDEX_P (regno)
: REGNO_MODE_OK_FOR_BASE_P (regno, mode)))
diff -rup orig/egcc-bib-CVS20020901/gcc/varasm.c egcc-bib-CVS20020901/gcc/varasm.c
--- orig/egcc-bib-CVS20020901/gcc/varasm.c 2002-09-01 22:46:08.000000000 -0400
+++ egcc-bib-CVS20020901/gcc/varasm.c 2002-09-02 09:07:18.624782961 -0400
@@ -4487,7 +4487,9 @@ weak_finish ()
for (t = weak_decls; t; t = TREE_CHAIN (t))
{
tree decl = TREE_VALUE (t);
- const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+#if defined (ASM_WEAKEN_DECL) || defined (ASM_WEAKEN_LABEL)
+ const char *const name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+#endif
if (! TREE_USED (decl))
continue;