aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-06-08 22:33:46 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-06-08 22:33:46 +0000
commit0f38b8114265421f93d37b835f1eb509c0f46247 (patch)
treed8ba494b63c0ae629f01eb15a7a2029026736c14 /gcc
parente6be21fe8783be5abd5c15b74b9be457a3095ec9 (diff)
downloadgcc-0f38b8114265421f93d37b835f1eb509c0f46247.zip
gcc-0f38b8114265421f93d37b835f1eb509c0f46247.tar.gz
gcc-0f38b8114265421f93d37b835f1eb509c0f46247.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-decl.c10
-rw-r--r--gcc/c-typeck.c3
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/920729-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/931018-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/redecl-1.c4
6 files changed, 21 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e6f8e98..7fcaca4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
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.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 378b53e..78c852e 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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;
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 478ec43..5653ae5 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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. */
diff --git a/gcc/testsuite/gcc.c-torture/compile/920729-1.c b/gcc/testsuite/gcc.c-torture/compile/920729-1.c
index 96676e9..de00be5 100644
--- a/gcc/testsuite/gcc.c-torture/compile/920729-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/920729-1.c
@@ -1,2 +1,2 @@
-extern int i;extern volatile int i;
+extern volatile int i;
f(){int j;for(;;)j = i;}
diff --git a/gcc/testsuite/gcc.c-torture/execute/931018-1.c b/gcc/testsuite/gcc.c-torture/execute/931018-1.c
index d3814e6..01b6050 100644
--- a/gcc/testsuite/gcc.c-torture/execute/931018-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/931018-1.c
@@ -1,5 +1,5 @@
unsigned int a[0x1000];
-extern unsigned long v;
+extern const unsigned long v;
main ()
{
diff --git a/gcc/testsuite/gcc.dg/noncompile/redecl-1.c b/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
index 65b0636..f4db950 100644
--- a/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
@@ -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" } */
}