+2001-06-08 Mark Mitchell <mark@codesourcery.com>
+
+ * c-decl.c (grokdeclarator): Make the TREE_TYPE for declarations
+ accurately reflect its cv-qualification.
+ * c-typeck.c (type_lists_compatible_p): Ignore the top-levl
+ cv-qualifiers on function types.
+
2001-06-08 Mark Mitchell <mark@codesourcery.com>
* basic-block.h: Improve comments.
if (decl_context == PARM)
{
- tree type_as_written = type;
+ tree type_as_written;
tree promoted_type;
/* A parameter declared as an array of T is really a pointer to T.
type = build_pointer_type (type);
type_quals = TYPE_UNQUALIFIED;
}
+ else if (type_quals)
+ type = c_build_qualified_type (type, type_quals);
+
+ type_as_written = type;
decl = build_decl (PARM_DECL, declarator, type);
if (size_varies)
type_quals = TYPE_UNQUALIFIED;
#endif
}
-
+ else if (type_quals)
+ type = c_build_qualified_type (type, type_quals);
+
decl = build_decl (VAR_DECL, declarator, type);
if (size_varies)
C_DECL_VARIABLE_SIZE (decl) = 1;
if (simple_type_promotes_to (TREE_VALUE (args1)) != NULL_TREE)
return 0;
}
- else if (! (newval = comptypes (TREE_VALUE (args1), TREE_VALUE (args2))))
+ else if (! (newval = comptypes (TYPE_MAIN_VARIANT (TREE_VALUE (args1)),
+ TYPE_MAIN_VARIANT (TREE_VALUE (args2)))))
{
/* Allow wait (union {union wait *u; int *i} *)
and wait (union wait *) to be compatible. */
-extern int i;extern volatile int i;
+extern volatile int i;
f(){int j;for(;;)j = i;}
unsigned int a[0x1000];
-extern unsigned long v;
+extern const unsigned long v;
main ()
{
int
foo ()
{
- int bar; /* { dg-error "previously declared" "previously declared" } */
- volatile int bar; /* { dg-error "redeclaration" "redeclaration" } */
+ int bar; /* { dg-error "previous.*decl" "previous.*decl" } */
+ volatile int bar; /* { dg-error "conflicting types" "conflicting types" } */
}