aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-09-06 15:09:31 -0700
committerIan Lance Taylor <iant@golang.org>2023-09-06 15:31:27 -0700
commite4775af423a590947a10429b9fa889f5d3d41d40 (patch)
tree86b0b2928f50c2019b9e7e76d96d3919bb8554ae /gcc
parent6de5f5a4fe85bde1ec555c42021637d770faea0d (diff)
downloadgcc-e4775af423a590947a10429b9fa889f5d3d41d40.zip
gcc-e4775af423a590947a10429b9fa889f5d3d41d40.tar.gz
gcc-e4775af423a590947a10429b9fa889f5d3d41d40.tar.bz2
-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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/godump.cc19
-rw-r--r--gcc/testsuite/gcc.misc-tests/godump-1.c11
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/godump.cc b/gcc/godump.cc
index 0893d5f..bdd2d10 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 95dabdc..f359a65 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;