From 0fef3fd0eada944c2677ba0680393a12979f970f Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sat, 2 Feb 2002 18:56:37 +0000 Subject: cpphash.h (struct spec_nodes): Remove n__CHAR_UNSIGNED__. * cpphash.h (struct spec_nodes): Remove n__CHAR_UNSIGNED__. * cpphash.c (_cpp_init_hashtable): Similarly. * cppinit.c (cpp_create_reader): Default the signed_char flag. (init_builtins): Define __CHAR_UNSIGNED__ appropriately. (COMMAND_LINE_OPTIONS): Recognise -f{un,}signed-char. (cpp_handle_option): Handle the new options. * cpplex.c (cpp_interpret_charconst): Use new flag. * cpplib.h (struct cpp_options): New member signed_char. * gcc.c (cpp_unique_options): Remove %c spec and documentation. (cpp_options): Handle -fsigned-char and -funsigned-char. (static_specs): Remove signed_char_spec. (do_spec1): Don't handle %c. * system.h: Poison SIGNED_CHAR_SPEC. * tradcif.y (yylex): Use flag_signed_char. * tradcpp.h (flag_signed_char): New. * tradcpp.c (flag_signed_char): New. (main): Handle new command-line options. (initialize_builtins): Define __CHAR_UNSIGNED__ if appropriate. config: * alpha/alpha.h (SIGNED_CHAR_SPEC): Remove. * avr/avr.h: Remove old comments. * i960/i960.h (CPP_SPEC): Pass -fsigned-char if -mic*. (CC1_SPEC): Pass -fsigned-char if -mic*. (SIGNED_CHAR_SPEC): Remove. doc: * tm.texi (SIGNED_CHAR_SPEC): Remove documentation. testsuite: * gcc.dg/cpp/uchar-1.c, uchar-2.c, uchar-3.c: New tests. From-SVN: r49444 --- gcc/cpplex.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gcc/cpplex.c') diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 8465350..70e6280 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -1903,14 +1903,13 @@ cpp_interpret_charconst (pfile, token, warn_multi, traditional, pchars_seen) else if (chars_seen > 1 && !traditional && warn_multi) cpp_warning (pfile, "multi-character character constant"); - /* If char type is signed, sign-extend the constant. The - __CHAR_UNSIGNED__ macro is set by the driver if appropriate. */ + /* If char type is signed, sign-extend the constant. */ if (token->type == CPP_CHAR && chars_seen) { unsigned int nbits = chars_seen * width; mask = (unsigned HOST_WIDE_INT) ~0 >> (HOST_BITS_PER_WIDE_INT - nbits); - if (pfile->spec_nodes.n__CHAR_UNSIGNED__->type == NT_MACRO + if (CPP_OPTION (pfile, signed_char) == 0 || ((result >> (nbits - 1)) & 1) == 0) result &= mask; else -- cgit v1.1