diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2000-08-18 09:15:51 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2000-08-18 09:15:51 +0000 |
commit | fa40aa121c3dd227bff080afa7a2f6e24b6c0c80 (patch) | |
tree | 8293de0001f05fdd2848c247d2b0e7d05fb336b4 /gcc/cp/error.c | |
parent | ca3a748a9fe15a3f476299158f97c7ab8a2fa9d6 (diff) | |
download | gcc-fa40aa121c3dd227bff080afa7a2f6e24b6c0c80.zip gcc-fa40aa121c3dd227bff080afa7a2f6e24b6c0c80.tar.gz gcc-fa40aa121c3dd227bff080afa7a2f6e24b6c0c80.tar.bz2 |
cp-tree.h (enum_name_string): Remove prototype.
* cp-tree.h (enum_name_string): Remove prototype.
(report_case_error): Remove prototype.
* cp/typeck2.c (enum_name_string): Remove.
(report_case_error): Remove.
* error.c (dump_expr): Deal with enum values directly.
Correctly negate integer constant.
From-SVN: r35774
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r-- | gcc/cp/error.c | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c index fb8ff38..b8063b3 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1469,8 +1469,23 @@ dump_expr (t, flags) /* If it's an enum, output its tag, rather than its value. */ if (TREE_CODE (type) == ENUMERAL_TYPE) { - const char *p = enum_name_string (t, type); - OB_PUTCP (p); + tree values = TYPE_VALUES (type); + + for (; values; + values = TREE_CHAIN (values)) + if (tree_int_cst_equal (TREE_VALUE (values), t)) + break; + + if (values) + OB_PUTID (TREE_PURPOSE (values)); + else + { + /* Value must have been cast. */ + OB_PUTC ('('); + dump_type (type, flags); + OB_PUTC (')'); + goto do_int; + } } else if (type == boolean_type_node) { @@ -1485,30 +1500,35 @@ dump_expr (t, flags) dump_char (tree_low_cst (t, 0)); OB_PUTC ('\''); } - else if ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (t) - != (TREE_INT_CST_LOW (t) >> (HOST_BITS_PER_WIDE_INT - 1))) + else { - tree val = t; - - if (tree_int_cst_sgn (val) < 0) + do_int: + if ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (t) + != (TREE_INT_CST_LOW (t) >> (HOST_BITS_PER_WIDE_INT - 1))) { - OB_PUTC ('-'); - val = build_int_2 (~TREE_INT_CST_LOW (val), - -TREE_INT_CST_HIGH (val)); + tree val = t; + + if (tree_int_cst_sgn (val) < 0) + { + OB_PUTC ('-'); + val = build_int_2 (-TREE_INT_CST_LOW (val), + ~TREE_INT_CST_HIGH (val) + + !TREE_INT_CST_LOW (val)); + } + /* Would "%x%0*x" or "%x%*0x" get zero-padding on all + systems? */ + { + static char format[10]; /* "%x%09999x\0" */ + if (!format[0]) + sprintf (format, "%%x%%0%dx", HOST_BITS_PER_INT / 4); + sprintf (digit_buffer, format, TREE_INT_CST_HIGH (val), + TREE_INT_CST_LOW (val)); + OB_PUTCP (digit_buffer); + } } - /* Would "%x%0*x" or "%x%*0x" get zero-padding on all - systems? */ - { - static char format[10]; /* "%x%09999x\0" */ - if (!format[0]) - sprintf (format, "%%x%%0%dx", HOST_BITS_PER_INT / 4); - sprintf (digit_buffer, format, TREE_INT_CST_HIGH (val), - TREE_INT_CST_LOW (val)); - OB_PUTCP (digit_buffer); - } + else + OB_PUTI (TREE_INT_CST_LOW (t)); } - else - OB_PUTI (TREE_INT_CST_LOW (t)); } break; |