aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
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/c-decl.c
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/c-decl.c')
-rw-r--r--gcc/c-decl.c10
1 files changed, 8 insertions, 2 deletions
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;