c-decl.c (grokdeclarator): Make the TREE_TYPE for declarations accurately reflect its cv-qualification.
* 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. From-SVN: r43056
This commit is contained in:
parent
e6be21fe87
commit
0f38b81142
@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
@ -4719,7 +4719,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
|
||||
|
||||
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.
|
||||
@ -4782,6 +4782,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
|
||||
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)
|
||||
@ -4908,6 +4912,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
|
||||
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)
|
||||
|
@ -651,7 +651,8 @@ type_lists_compatible_p (args1, args2)
|
||||
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. */
|
||||
|
@ -1,2 +1,2 @@
|
||||
extern int i;extern volatile int i;
|
||||
extern volatile int i;
|
||||
f(){int j;for(;;)j = i;}
|
||||
|
@ -1,5 +1,5 @@
|
||||
unsigned int a[0x1000];
|
||||
extern unsigned long v;
|
||||
extern const unsigned long v;
|
||||
|
||||
main ()
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
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" } */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user