godump.c (go_output_typedef): Support printing enum values that don't fit in a signed...
authorJakub Jelinek <jakub@redhat.com>
Mon, 3 Oct 2011 20:09:56 +0000 (22:09 +0200)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 3 Oct 2011 20:09:56 +0000 (20:09 +0000)
* godump.c (go_output_typedef): Support printing enum values that
don't fit in a signed HOST_WIDE_INT.

Co-Authored-By: Ian Lance Taylor <iant@google.com>
From-SVN: r179477

gcc/ChangeLog
gcc/godump.c

index 74839b7650609b9757ebbdb0764d7494429839a8..2874c05740fce0bbd712e6e51ea719f3bf56a508 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-03  Jakub Jelinek  <jakub@redhat.com>
+           Ian Lance Taylor  <iant@google.com>
+
+       * godump.c (go_output_typedef): Support printing enum values that
+       don't fit in a signed HOST_WIDE_INT.
+
 2011-10-03  Anatoly Sokolov  <aesok@post.ru>
 
        * config/cris/cris.c (cris_output_addr_const_extra): Make static.
index 11cd32998ec92f737e225e5cbcd4e1d2759116f8..f9f767c81131c0c08e86d06b5cdb2fdc8a3b044e 100644 (file)
@@ -920,9 +920,20 @@ go_output_typedef (struct godump_container *container, tree decl)
          if (*slot == NULL)
            {
              *slot = CONST_CAST (char *, name);
-             fprintf (go_dump_file,
-                      "const _%s = " HOST_WIDE_INT_PRINT_DEC "\n",
-                      name, tree_low_cst (TREE_VALUE (element), 0));
+             fprintf (go_dump_file, "const _%s = ", name);
+             if (host_integerp (TREE_VALUE (element), 0))
+               fprintf (go_dump_file, HOST_WIDE_INT_PRINT_DEC,
+                        tree_low_cst (TREE_VALUE (element), 0));
+             else if (host_integerp (TREE_VALUE (element), 1))
+               fprintf (go_dump_file, HOST_WIDE_INT_PRINT_UNSIGNED,
+                        ((unsigned HOST_WIDE_INT)
+                         tree_low_cst (TREE_VALUE (element), 1)));
+             else
+               fprintf (go_dump_file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+                        ((unsigned HOST_WIDE_INT)
+                         TREE_INT_CST_HIGH (TREE_VALUE (element))),
+                        TREE_INT_CST_LOW (TREE_VALUE (element)));
+             fprintf (go_dump_file, "\n");
            }
        }
       pointer_set_insert (container->decls_seen, TREE_TYPE (decl));