public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6643] c++: handle _FloatNN redeclaration like bool [PR107128]
Date: Mon, 13 Mar 2023 20:16:53 +0000 (GMT)	[thread overview]
Message-ID: <20230313201653.542973858C2D@sourceware.org> (raw)

https://gcc.gnu.org/g:538a0d0f29b12cff05681b6de2e0a3d7b33f3ef0

commit r13-6643-g538a0d0f29b12cff05681b6de2e0a3d7b33f3ef0
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Mar 13 14:06:11 2023 -0400

    c++: handle _FloatNN redeclaration like bool [PR107128]
    
    It's been inconvenient to compile testcases preprocessed with GCC 12 or
    earlier because they break on
    
      typedef __float128 _Float128;
    
    We already had code for handling this with bool and wchar_t, it just needs
    to be extended to _FloatNN as well.
    
            PR c++/107128
    
    gcc/cp/ChangeLog:
    
            * parser.cc (cp_parser_set_decl_spec_type): Use
            redefined_builtin_type for extended_float_type_p.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/warn/pragma-system_header6.h: New test.
            * g++.dg/warn/pragma-system_header6.C: New test.

Diff:
---
 gcc/testsuite/g++.dg/warn/pragma-system_header6.h | 3 +++
 gcc/cp/parser.cc                                  | 2 ++
 gcc/testsuite/g++.dg/warn/pragma-system_header6.C | 1 +
 3 files changed, 6 insertions(+)

diff --git a/gcc/testsuite/g++.dg/warn/pragma-system_header6.h b/gcc/testsuite/g++.dg/warn/pragma-system_header6.h
new file mode 100644
index 00000000000..989ccd8795a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pragma-system_header6.h
@@ -0,0 +1,3 @@
+#pragma GCC system_header
+
+typedef float _Float32;
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 533041946c0..a277003ea58 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -33452,10 +33452,12 @@ cp_parser_set_decl_spec_type (cp_decl_specifier_seq *decl_specs,
      C++-safe.  */
   if (decl_spec_seq_has_spec_p (decl_specs, ds_typedef)
       && !type_definition_p
+      && TYPE_P (type_spec)
       && (type_spec == boolean_type_node
 	  || type_spec == char8_type_node
 	  || type_spec == char16_type_node
 	  || type_spec == char32_type_node
+	  || extended_float_type_p (type_spec)
 	  || type_spec == wchar_type_node)
       && (decl_specs->type
 	  || decl_spec_seq_has_spec_p (decl_specs, ds_long)
diff --git a/gcc/testsuite/g++.dg/warn/pragma-system_header6.C b/gcc/testsuite/g++.dg/warn/pragma-system_header6.C
new file mode 100644
index 00000000000..924e4522cf0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pragma-system_header6.C
@@ -0,0 +1 @@
+#include "pragma-system_header6.h"

                 reply	other threads:[~2023-03-13 20:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313201653.542973858C2D@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).