This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C/C++ FEs: Do we really need three char_type_nodes?
On Sun, Sep 21, 2008 at 2:28 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Index: tree.c
> ===================================================================
> --- tree.c (revision 140524)
> +++ tree.c (working copy)
> @@ -7364,8 +7364,8 @@
> but not the same as either. */
> char_type_node
> = (signed_char
> - ? make_signed_type (CHAR_TYPE_SIZE)
> - : make_unsigned_type (CHAR_TYPE_SIZE));
> + ? build_distinct_type_copy (signed_char_type_node)
> + : build_distinct_type_copy (unsigned_char_type_node));
*sigh* Wrong patch.
Index: tree.c
===================================================================
--- tree.c (revision 140524)
+++ tree.c (working copy)
@@ -7362,10 +7362,16 @@
/* Define `char', which is like either `signed char' or `unsigned char'
but not the same as either. */
- char_type_node
- = (signed_char
- ? make_signed_type (CHAR_TYPE_SIZE)
- : make_unsigned_type (CHAR_TYPE_SIZE));
+ if (signed_char)
+ {
+ char_type_node = make_signed_type (CHAR_TYPE_SISE);
+ TYPE_CANONICAL (char_type_node) = signed_char_type_node;
+ }
+ else
+ {
+ char_type_node = make_unsigned_type (CHAR_TYPE_SISE);
+ TYPE_CANONICAL (char_type_node) = unsigned_char_type_node;
+ }
TYPE_STRING_FLAG (char_type_node) = 1;
short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE);