c-decl.c (diagnose_mismatched_decls): Improve error message.

2004-06-13  Eric Christopher  <echristo@redhat.com>

	* c-decl.c (diagnose_mismatched_decls): Improve error message.
	Remove unused code.
	* c-typeck.c (comptypes): Add location in standard we're checking.

2004-06-13  Eric Christopher  <echristo@redhat.com>

	* gcc.dg/noncompile/redecl-1.c: Fix error message.

From-SVN: r83060
This commit is contained in:
Eric Christopher 2004-06-13 16:24:52 +00:00
parent fc6b41718d
commit 118a3a8ba8
5 changed files with 30 additions and 41 deletions

View File

@ -1,3 +1,9 @@
2004-06-13 Eric Christopher <echristo@redhat.com>
* c-decl.c (diagnose_mismatched_decls): Improve error message.
Remove unused code.
* c-typeck.c (comptypes): Add location in standard we're checking.
2004-06-13 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/libgcc-std.ver: Add __unorddf2 and __unordsf2 with

View File

@ -1138,6 +1138,9 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
}
else
{
if (TYPE_QUALS (newtype) != TYPE_QUALS (oldtype))
error ("%J conflicting type qualifiers for '%D'", newdecl, newdecl);
else
error ("%Jconflicting types for '%D'", newdecl, newdecl);
diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype);
locate_old_decl (olddecl, error);
@ -1365,28 +1368,6 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
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))
{
if (TREE_THIS_VOLATILE (newdecl))
pedwarn ("%Jvolatile declaration of '%D' follows "
"non-volatile declaration", newdecl, newdecl);
else
pedwarn ("%Jnon-volatile declaration of '%D' follows "
"volatile declaration", newdecl, newdecl);
pedwarned = true;
}
if (TREE_READONLY (newdecl) != TREE_READONLY (olddecl))
{
if (TREE_READONLY (newdecl))
pedwarn ("%Jconst declaration of '%D' follows "
"non-const declaration", newdecl, newdecl);
else
pedwarn ("%Jnon-const declaration of '%D' follows "
"const declaration", newdecl, newdecl);
pedwarned = true;
}
}
/* Optional warning for completely redundant decls. */

View File

@ -598,7 +598,7 @@ comptypes (tree type1, tree type2, int flags)
if (TREE_CODE (t1) != TREE_CODE (t2))
return 0;
/* Qualifiers must match. */
/* Qualifiers must match. C99 6.7.3p9 */
if (TYPE_QUALS (t1) != TYPE_QUALS (t2))
return 0;

View File

@ -1,3 +1,7 @@
2004-06-13 Eric Christopher <echristo@redhat.com>
* gcc.dg/noncompile/redecl-1.c: Fix error message.
2004-06-12 Paul Brook <paul@codesourcery.com>
* gfortran.fortran-torture/execute/contained_3.f90: New test.
@ -17021,4 +17025,3 @@ rlsruhe.de>
correspond to c-torture 1.11.
* New file.

View File

@ -5,6 +5,5 @@ int
foo ()
{
int bar; /* { dg-error "previous.*decl" "previous.*decl" } */
volatile int bar; /* { dg-error "conflicting types" "conflicting types" } */
volatile int bar; /* { dg-error "conflicting type qualifiers" "conflicting type qualifiers" } */
}