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/cppinit.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gcc/cppinit.c') diff --git a/gcc/cppinit.c b/gcc/cppinit.c index ab3dad7..717fb3f 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -490,6 +490,11 @@ cpp_create_reader (lang) CPP_OPTION (pfile, show_column) = 1; CPP_OPTION (pfile, tabstop) = 8; CPP_OPTION (pfile, operator_names) = 1; +#if DEFAULT_SIGNED_CHAR + CPP_OPTION (pfile, signed_char) = 1; +#else + CPP_OPTION (pfile, signed_char) = 0; +#endif CPP_OPTION (pfile, pending) = (struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending)); @@ -761,6 +766,9 @@ init_builtins (pfile) else if (CPP_OPTION (pfile, c99)) _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L"); + if (CPP_OPTION (pfile, signed_char) == 0) + _cpp_define_builtin (pfile, "__CHAR_UNSIGNED__ 1"); + if (CPP_OPTION (pfile, lang) == CLK_STDC89 || CPP_OPTION (pfile, lang) == CLK_STDC94 || CPP_OPTION (pfile, lang) == CLK_STDC99) @@ -1186,7 +1194,9 @@ new_pending_directive (pend, text, handler) DEF_OPT("fno-show-column", 0, OPT_fno_show_column) \ DEF_OPT("fpreprocessed", 0, OPT_fpreprocessed) \ DEF_OPT("fshow-column", 0, OPT_fshow_column) \ + DEF_OPT("fsigned-char", 0, OPT_fsigned_char) \ DEF_OPT("ftabstop=", no_num, OPT_ftabstop) \ + DEF_OPT("funsigned-char", 0, OPT_funsigned_char) \ DEF_OPT("h", 0, OPT_h) \ DEF_OPT("idirafter", no_dir, OPT_idirafter) \ DEF_OPT("imacros", no_fil, OPT_imacros) \ @@ -1395,6 +1405,12 @@ cpp_handle_option (pfile, argc, argv, ignore) case OPT_fno_show_column: CPP_OPTION (pfile, show_column) = 0; break; + case OPT_fsigned_char: + CPP_OPTION (pfile, signed_char) = 1; + break; + case OPT_funsigned_char: + CPP_OPTION (pfile, signed_char) = 0; + break; case OPT_ftabstop: /* Silently ignore empty string, non-longs and silly values. */ if (arg[0] != '\0') -- cgit v1.1