Commit 3205a71e by Zack Weinberg

re PR c/13728 (Duplicate parameter names not detected)

	PR 13728
	* c-decl.c (diagnose_mismatched_decls): Issue an error for two
	parameters with the same name, unless one is a forward decl.
	Do not issue a redundant-redeclaration warning for forward
	decls of parameters.
	* gcc.dg/decl-4.c: New testcase.

From-SVN: r78888
parent e8d8a034
2004-03-03 Zack Weinberg <zack@codesourcery.com>
PR 13728
* c-decl.c (diagnose_mismatched_decls): Issue an error for two
parameters with the same name, unless one is a forward decl.
Do not issue a redundant-redeclaration warning for forward
decls of parameters.
2004-03-04 David Edelsohn <edelsohn@gnu.org>
* doc/install.texi (*-ibm-aix*): Document use of Bash to speed up
......@@ -94,7 +102,7 @@
2004-03-03 Stuart Hastings <stuart@apple.com>
* gcc/config.gcc: Arrange for Darwin/x86 to build libgcc_eh.a.
2004-03-03 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sparc.c (noov_compare64_op): Fix typo.
......@@ -389,10 +397,10 @@
2004-03-02 Richard Henderson <rth@redhat.com>
PR middle-end/11767
* coverage.c (coverage_counter_ref): Set MEM_NOTRAP_P.
* optabs.c (prepare_cmp_insn): Force trapping memories to registers
before the compare, if flag_non_call_exceptions.
PR middle-end/11767
* coverage.c (coverage_counter_ref): Set MEM_NOTRAP_P.
* optabs.c (prepare_cmp_insn): Force trapping memories to registers
before the compare, if flag_non_call_exceptions.
2004-03-02 Richard Henderson <rth@redhat.com>
......@@ -873,7 +881,7 @@
enable_rtl_dump_file): Declare.
2004-02-27 Eric Botcazou <ebotcazou@act-europe.fr>
Roger Sayle <roger@eyesopen.com>
Roger Sayle <roger@eyesopen.com>
* fold-const.c (fold): Revert 2004-02-25 change. Use the original
operands to build a tree with swapped operands.
......@@ -1084,11 +1092,11 @@
2004-02-24 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/spe.md (spe_fix_truncsfsi2): Delete.
(spe_fixuns_truncsfsi2): Delete.
* config/rs6000/spe.md (spe_fix_truncsfsi2): Delete.
(spe_fixuns_truncsfsi2): Delete.
* config/rs6000/rs6000.md (fix_truncsfsi2): Delete.
(fixuns_truncsfsi2): Delete.
* config/rs6000/rs6000.md (fix_truncsfsi2): Delete.
(fixuns_truncsfsi2): Delete.
2004-02-24 Josef Zlomek <zlomekj@suse.cz>
......@@ -1578,7 +1586,7 @@
* config/i386/i386.c: Rename pni to sse3.
* config/i386/i386.h: Likewise.
* config/i386/i386.md: Likewise.
* config/i386/i386.md: Likewise.
* config/i386/pmmintrin.h: Likewise.
* doc/extend.texi: Likewise.
* doc/invoke.texi: Likewise.
......@@ -1628,7 +1636,7 @@
(movdf_softfloat64): Ditto.
2004-02-23 Fariborz Jahanian <fjahanian@apple.com>
* config/rs6000/rs6000.c (function_arg): call to
* config/rs6000/rs6000.c (function_arg): call to
rs6000_mixed_function_arg for DFmode moved to allow
normal DFmode incoming register assignment.
......@@ -1668,7 +1676,7 @@
TARGET_DEFAULT_SHORT_ENUMS. Update the description.
2004-02-23 Eric Botcazou <ebotcazou@libertysurf.fr>
Falk Hueffner <falk@debian.org>
Falk Hueffner <falk@debian.org>
PR c/14188
* builtins.c (expand_builtin_va_arg): Emit an informative message
......@@ -1810,7 +1818,7 @@
2004-02-20 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR c++/12007
PR c++/12007
* dbxout.c (dbxout_parms): Check that DECL_RTL and DECL_INCOMING_RTL
are set for parameters before outputing debugging information.
......@@ -1860,7 +1868,7 @@
2004-02-20 Matt Kraai <kraai@alumni.cmu.edu>
* doc/install.texi (Building the Ada compiler): Remove
example.
example.
2004-02-20 James E Wilson <wilson@specifixinc.com>
......
......@@ -1211,8 +1211,18 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
}
}
}
else /* VAR_DECL */
else /* PARM_DECL, VAR_DECL */
{
/* Redeclaration of a PARM_DECL is invalid unless this is the
real position of a forward-declared parameter (GCC extension). */
if (TREE_CODE (newdecl) == PARM_DECL
&& (!TREE_ASM_WRITTEN (olddecl) || TREE_ASM_WRITTEN (newdecl)))
{
error ("%Jredefinition of parameter '%D'", newdecl, newdecl);
locate_old_decl (olddecl, error);
return false;
}
/* These bits are only type qualifiers when applied to objects. */
if (TREE_THIS_VOLATILE (newdecl) != TREE_THIS_VOLATILE (olddecl))
{
......@@ -1241,10 +1251,13 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& warn_redundant_decls
/* Don't warn about a function declaration followed by a
definition. */
&& !(TREE_CODE (newdecl) == FUNCTION_DECL
&& DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl))
/* Don't warn about an extern followed by a definition. */
&& !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl)))
&& !(TREE_CODE (newdecl) == FUNCTION_DECL
&& DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl))
/* Don't warn about an extern followed by a definition. */
&& !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl))
/* Don't warn about forward parameter decls. */
&& !(TREE_CODE (newdecl) == PARM_DECL
&& TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl)))
{
warning ("%Jredundant redeclaration of '%D'", newdecl, newdecl);
warned = true;
......
2004-03-03 Zack Weinberg <zack@codesourcery.com>
PR 13728
* gcc.dg/decl-4.c: New testcase.
2004-03-03 Kazu Hirata <kazu@cs.umass.edu>
* gcc.dg/torture/builtin-explog-1.c (PREC): Make it the same
......@@ -23,7 +28,7 @@
PR c++/14360
* g++.old-deja/g++.ns/koenig5.C: Remove some error markers.
PR c++/14361
* g++.dg/parse/defarg7.C: New test.
......@@ -92,8 +97,8 @@
2004-02-26 Richard Henderson <rth@redhat.com>
* g++.dg/ext/attrib10.C: Mark for warning.
* gcc.dg/attr-alias-1.c: New.
* g++.dg/ext/attrib10.C: Mark for warning.
* gcc.dg/attr-alias-1.c: New.
2004-02-26 Richard Henderson <rth@redhat.com>
......@@ -105,28 +110,28 @@
* lib/target-supports.exp (check-iconv-available): New function.
* lib/gcc-dg.exp (dg-require-iconv): New function.
Use above.
* gcc.dg/charset: New directory.
* gcc.dg/charset/charset.exp: New file.
* gcc.dg/charset/asm1.c: Ditto.
* gcc.dg/charset/asm2.c: Ditto.
* gcc.dg/charset/asm3.c: Ditto.
* gcc.dg/charset/asm4.c: Ditto.
* gcc.dg/charset/asm5.c: Ditto.
* gcc.dg/charset/attribute1.c: Ditto.
* gcc.dg/charset/attribute2.c: Ditto.
* gcc.dg/charset/string1.c: Ditto.
* g++.dg/charset: New directory.
* g++.dg/dg.exp: Add here. Special options.
* g++.dg/charset/charset.exp: New file.
* g++.dg/charset/asm1.c: Ditto.
* g++.dg/charset/asm2.c: Ditto.
* g++.dg/charset/asm3.c: Ditto.
* g++.dg/charset/asm4.c: Ditto.
* g++.dg/charset/attribute1.c: Ditto.
* g++.dg/charset/attribute2.c: Ditto.
* g++.dg/charset/extern1.cc: Ditto.
* g++.dg/charset/extern2.cc: Ditto.
* g++.dg/charset/string1.c: Ditto.
* gcc.dg/charset: New directory.
* gcc.dg/charset/charset.exp: New file.
* gcc.dg/charset/asm1.c: Ditto.
* gcc.dg/charset/asm2.c: Ditto.
* gcc.dg/charset/asm3.c: Ditto.
* gcc.dg/charset/asm4.c: Ditto.
* gcc.dg/charset/asm5.c: Ditto.
* gcc.dg/charset/attribute1.c: Ditto.
* gcc.dg/charset/attribute2.c: Ditto.
* gcc.dg/charset/string1.c: Ditto.
* g++.dg/charset: New directory.
* g++.dg/dg.exp: Add here. Special options.
* g++.dg/charset/charset.exp: New file.
* g++.dg/charset/asm1.c: Ditto.
* g++.dg/charset/asm2.c: Ditto.
* g++.dg/charset/asm3.c: Ditto.
* g++.dg/charset/asm4.c: Ditto.
* g++.dg/charset/attribute1.c: Ditto.
* g++.dg/charset/attribute2.c: Ditto.
* g++.dg/charset/extern1.cc: Ditto.
* g++.dg/charset/extern2.cc: Ditto.
* g++.dg/charset/string1.c: Ditto.
2004-02-26 Mark Mitchell <mark@codesourcery.com>
......
/* Redeclaration of parameters is an error. PR 13728. */
/* { dg-do compile } */
void f (int fred, /* { dg-error "previous definition" "" } */
int fred); /* { dg-error "redefinition of parameter" "" } */
void f2 (int fred, /* { dg-error "previous definition" "" } */
int fred) /* { dg-error "redefinition of parameter" "" } */
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment