aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-08-30 14:25:43 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-08-30 14:25:43 +0200
commit2d51e5a7af9a1625a56c272ac1c1b602ae414978 (patch)
tree83daad4d19470a7a9b2ed2de127fdf2ede5a8df8 /gcc/c
parent59ab6dc89f8f0e76d3e9419aa11e1f26104e4ef0 (diff)
downloadgcc-2d51e5a7af9a1625a56c272ac1c1b602ae414978.zip
gcc-2d51e5a7af9a1625a56c272ac1c1b602ae414978.tar.gz
gcc-2d51e5a7af9a1625a56c272ac1c1b602ae414978.tar.bz2
backport: re PR c/89734 (const qualifier on return type not erased inside __typeof__)
Backported from mainline 2019-03-19 Jakub Jelinek <jakub@redhat.com> PR c/89734 * c-decl.c (grokdeclarator): Call c_build_qualified_type on function return type even if quals_used is 0. Formatting fixes. * gcc.dg/pr89734.c: New test. From-SVN: r275134
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog9
-rw-r--r--gcc/c/c-decl.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index ab2eae1..e6108f1 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,12 @@
+2019-08-30 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2019-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/89734
+ * c-decl.c (grokdeclarator): Call c_build_qualified_type on function
+ return type even if quals_used is 0. Formatting fixes.
+
2019-01-16 Joseph Myers <joseph@codesourcery.com>
Backport from mainline
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 14a3832..8342094 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -6361,10 +6361,12 @@ grokdeclarator (const struct c_declarator *declarator,
quals_used &= TYPE_QUAL_ATOMIC;
if (quals_used && VOID_TYPE_P (type) && really_funcdef)
pedwarn (specs_loc, 0,
- "function definition has qualified void return type");
+ "function definition has qualified void "
+ "return type");
else
warning_at (specs_loc, OPT_Wignored_qualifiers,
- "type qualifiers ignored on function return type");
+ "type qualifiers ignored on function "
+ "return type");
/* Ensure an error for restrict on invalid types; the
DR#423 resolution is not entirely clear about
@@ -6374,8 +6376,7 @@ grokdeclarator (const struct c_declarator *declarator,
&& (!POINTER_TYPE_P (type)
|| !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type))))
error_at (loc, "invalid use of %<restrict%>");
- if (quals_used)
- type = c_build_qualified_type (type, quals_used);
+ type = c_build_qualified_type (type, quals_used);
}
type_quals = TYPE_UNQUALIFIED;