Commit 0f38b811 by Mark Mitchell Committed by Mark Mitchell

c-decl.c (grokdeclarator): Make the TREE_TYPE for declarations accurately…

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
parent e6be21fe
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.
* except.c (expand_eh_region_end_allowed): Remove redundant call
to do_pending_stack_adjust.
......
......@@ -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,7 +4912,9 @@ 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)
C_DECL_VARIABLE_SIZE (decl) = 1;
......
......@@ -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. */
......
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 ()
{
......
......@@ -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" } */
}
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