From 2d51e5a7af9a1625a56c272ac1c1b602ae414978 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 30 Aug 2019 14:25:43 +0200 Subject: backport: re PR c/89734 (const qualifier on return type not erased inside __typeof__) Backported from mainline 2019-03-19 Jakub Jelinek 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 --- gcc/c/ChangeLog | 9 +++++++++ gcc/c/c-decl.c | 9 +++++---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'gcc/c') 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 + + Backported from mainline + 2019-03-19 Jakub Jelinek + + 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 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 %"); - if (quals_used) - type = c_build_qualified_type (type, quals_used); + type = c_build_qualified_type (type, quals_used); } type_quals = TYPE_UNQUALIFIED; -- cgit v1.1