public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-3762] -fgo-dump-spec: support _BitInt
Date: Wed,  6 Sep 2023 22:32:30 +0000 (GMT)	[thread overview]
Message-ID: <20230906223230.5A6DC3858C66@sourceware.org> (raw)

https://gcc.gnu.org/g:e4775af423a590947a10429b9fa889f5d3d41d40

commit r14-3762-ge4775af423a590947a10429b9fa889f5d3d41d40
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Sep 6 15:09:31 2023 -0700

    -fgo-dump-spec: support _BitInt
    
    gcc/
            PR go/111310
            * godump.cc (go_format_type): Handle BITINT_TYPE.
    
    gcc/testsuite/
            PR go/111310
            * gcc.misc-tests/godump-1.c: Add _BitInt test cases.

Diff:
---
 gcc/godump.cc                           | 19 +++++++++++++++++++
 gcc/testsuite/gcc.misc-tests/godump-1.c | 11 +++++++++++
 2 files changed, 30 insertions(+)

diff --git a/gcc/godump.cc b/gcc/godump.cc
index 0893d5fbc976..bdd2d108d76d 100644
--- a/gcc/godump.cc
+++ b/gcc/godump.cc
@@ -760,6 +760,25 @@ go_format_type (class godump_container *container, tree type,
       }
       break;
 
+    case BITINT_TYPE:
+      {
+	const char *s;
+	char buf[100];
+
+	s = go_get_uinttype_for_precision (TYPE_PRECISION (type),
+					   TYPE_UNSIGNED (type));
+	if (s == NULL)
+	  {
+	    snprintf (buf, sizeof buf, "INVALID-bitint-%u%s",
+		      TYPE_PRECISION (type),
+		      TYPE_UNSIGNED (type) ? "u" : "");
+	    s = buf;
+	    ret = false;
+	  }
+	obstack_grow (ob, s, strlen(s));
+      }
+      break;
+
     case REAL_TYPE:
       {
 	const char *s;
diff --git a/gcc/testsuite/gcc.misc-tests/godump-1.c b/gcc/testsuite/gcc.misc-tests/godump-1.c
index 95dabdc0e4c0..f359a6578279 100644
--- a/gcc/testsuite/gcc.misc-tests/godump-1.c
+++ b/gcc/testsuite/gcc.misc-tests/godump-1.c
@@ -234,6 +234,17 @@ const char cc_v1;
 cc_t cc_v2;
 /* { dg-final { scan-file godump-1.out "(?n)^var _cc_v2 _cc_t$" } } */
 
+_BitInt(32) b32_v;
+/* { dg-final { scan-file godump-1.out "(?n)^var _b32_v int32$" } } */
+
+_BitInt(64) b64_v;
+/* { dg-final { scan-file godump-1.out "(?n)^var _b64_v int64$" } } */
+
+unsigned _BitInt(32) b32u_v;
+/* { dg-final { scan-file godump-1.out "(?n)^var _b32u_v uint32$" } } */
+
+_BitInt(33) b33_v;
+/* { dg-final { scan-file godump-1.out "(?n)^// var _b33_v INVALID-bitint-33$" } } */
 
 /*** pointer and array types ***/
 typedef void *vp_t;

                 reply	other threads:[~2023-09-06 22:32 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=20230906223230.5A6DC3858C66@sourceware.org \
    --to=ian@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).