]> gcc.gnu.org Git - gcc.git/commitdiff
-fgo-dump-spec: support _BitInt
authorIan Lance Taylor <iant@golang.org>
Wed, 6 Sep 2023 22:09:31 +0000 (15:09 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 6 Sep 2023 22:31:27 +0000 (15:31 -0700)
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.

gcc/godump.cc
gcc/testsuite/gcc.misc-tests/godump-1.c

index 0893d5fbc976bd0d0fc96cd1caf9c64aa927a4b5..bdd2d108d76d6c1244fec71a06061007ae5ee36e 100644 (file)
@@ -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;
index 95dabdc0e4c083d9085f20d3b2635d3843d5edca..f359a6578279c3130f0f663af32c64cc4ad4d956 100644 (file)
@@ -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;
This page took 0.175015 seconds and 5 git commands to generate.