aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
AgeCommit message (Collapse)AuthorFilesLines
2002-08-01cppinit.c (COMMAND_LINE_OPTIONS): Remove OPT_dollar.Neil Booth1-5/+0
* cppinit.c (COMMAND_LINE_OPTIONS): Remove OPT_dollar. (cpp_handle_option): Don't handle it. (print_help): Update. * doc/cppopts.texi: Update. From-SVN: r55925
2002-07-23cppexp.c (parse_defined): Mark macro used.Neil Booth1-0/+15
* cppexp.c (parse_defined): Mark macro used. * cpphash.h (struct cpp_macro): New member "used". (_cpp_mark_macro_used, _cpp_warn_if_unused_macro): New. (struct cpp_reader): New member. * cppinit.c (cpp_finish_options): Set first_unused_line. (cpp_finish): Warn of unused macros if requested. (OPT_TABLE): New switches. (cpp_handle_option): Handle them. * cpplib.c (do_undef): Warn if macro unused. (do_ifdef, do_ifndef): Mark macro used. * cpplib.h (struct cpp_options): New member. * cppmacro.c (_cpp_warn_if_unused_macro): New. (enter_macro_context): Mark macro used. (_cpp_create_definition): Mark macro unused; warn if unused when redefined. * cpptrad.c (scan_out_logcial_line, push_replacement_text): Mark macros used. * doc/cppopts.texi: Update. testsuite: * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/trad/Wunused.h, gcc.dg/cpp/Wunused.c, gcc.dg/cpp/Wunused.h: New tests. From-SVN: r55692
2002-07-21c-lex.c (GET_ENVIRONMENT): Remove.Neil Booth1-11/+5
* c-lex.c (GET_ENVIRONMENT): Remove. * collect2.c (GET_ENV_PATH_LIST): Remove. (prefix_from_env): Use GET_ENVIRONMENT. * cppinit.c (GET_ENV_PATH_LIST): Remove. (init_standard_includes): Use GET_ENVIRONMENT. * defaults.h (GET_ENVIRONMENT): Define here if not already. * gcc.c (GET_ENV_PATH_LIST): Remove. (make_relative_prefix, process_command): Update. * protoize.c (GET_ENV_PATH_LIST): Remove. (do_processing): Update. java: * jcf-path.c (GET_ENV_PATH_LIST): Remove. (jcf_path_init): Use GET_ENVIRONMENT. From-SVN: r55630
2002-07-20cppexp.c (struct op): Add token pointer.Neil Booth1-0/+1
* cppexp.c (struct op): Add token pointer. (check_promotion, CHECK_PROMOTION): New. (optab): Update. (_cpp_parse_expr): Update, use token pointer of struct op. (reduce): Warn about change of sign owing to promotion. * cppinit.c (cpp_handle_option): New warning if -Wall. * cpplib.h (struct cpp_options): New member. testsuite: * gcc.dg/cpp/Wsignprom.c: New tests. From-SVN: r55611
2002-07-02cppinit.c (cpp_handle_option): Suppress warnings with an implicit "-w" for ↵Neil Booth1-14/+14
"-M" and "-MM". * cppinit.c (cpp_handle_option): Suppress warnings with an implicit "-w" for "-M" and "-MM". From-SVN: r55195
2002-06-19cpphash.h (struct cpp_reader): Make date and time strings.Neil Booth1-4/+7
* cpphash.h (struct cpp_reader): Make date and time strings. (_cpp_builtin_macro_text, _cpp_copy_replacement_text, _cpp_replacement_text_len): New. * cppinit.c (cpp_create_reader): Update. (init_builtins): Register appropriate builtins for -traditional-cpp. * cppmacro.c (new_number_token): Remove. (_cpp_builtin_macro_text): New. (builtin_macro): Use it. (cpp_macro_definition): Update to handle traditional macros. * cppmain.c (cb_line_change): Don't do column positioning for traditional output. * cpptrad.c (enum ls): Rename ls_fun_macro to ls_fun_open. New state ls_fun_close. (skip_whitespace): Fix. (maybe_start_funlike): Don't set state.parsing_args. (scan_out_logical_line): Remove duplicate error. Use lex_state rather than state.parsing_args. (push_replacement_text): Handle builtins. (_cpp_replacement_text_len, _cpp_copy_replacement_text): New. From-SVN: r54771
2002-06-11Makefile.in: Update cppmain.o.Neil Booth1-4/+5
* Makefile.in: Update cppmain.o. * cpphash.h (struct cpp_reader): Move some members to a nested structure. (trad_line): Rename saved_line. (_cpp_read_logical_line_trad): Update. (_cpp_remove_overlay): New. * cppinit.c (cpp_create_reader): No need to set saved_line. (cpp_destroy): Update. (cpp_read_main_file): Only overlay if compiling. * cpplex.c (continue_after_nul): Return false if in directive. * cpplib.c (EXPAND): New. (directive_table, SEEN_EOL): Update. (end_directive): Remove overlay if traditional; don't skip line in traditional #define. (prepare_directive_trad): New. (_cpp_handle_directive, run_directive): Update for traditional directives. (lex_macro_node): Simplify, don't use lex_identifier_trad. * cpplib.h (struct options): Add preprocess_only. * cppmain.c: Don't include intl.h. (cpp_preprocess_file): Set options->preprocess_only. (scan_translation_unit_trad): Fix, and print line numbers. * cpptrad.c (check_output_buffer, lex_identifier, scan_parameters, maybe_start_funlike, scan_out_logical_line, replace_args_and_push, save_replacement_text, _cpp_create_trad_definition): Update for variable renaming. (_cpp_overlay_buffer): Save line number. (_cpp_remove_overlay): Rename from restore_buff, restore line. (_cpp_read_logical_line_trad): Don't handle overlays here. (scan_out_logical_line): Process directives. From-SVN: r54485
2002-06-09Makefile.in (LIBCPP_OBJS): Take out version.o.Zack Weinberg1-24/+3
* Makefile.in (LIBCPP_OBJS): Take out version.o. * cpphash.h (cpp_reader): Take out print_version member. * cppinit.c: (cpp_handle_option): Don't do anything with -version. Just set help_only for --version, --target-help. Just set verbose option for -v. (cpp_post_options): Don't print a version string. From-SVN: r54390
2002-06-07cppinit.c (COMMAND_LINE_OPTIONS): Give all relevant -W options their own ↵Zack Weinberg1-59/+85
entries. * cppinit.c (COMMAND_LINE_OPTIONS): Give all relevant -W options their own entries. (parse_option): Clarify comment. (cpp_handle_option): Remove 'ignore' parameter and OPT_W special case. Replace if/strcmp chain for -W options with use of new OPT_* entries for them. (cpp_handle_options): Update to match. * cpplib.h: Remove last parameter to cpp_handle_option from prototype. * c-decl.c, cp/decl2.c: Update call to cpp_handle_option. From-SVN: r54352
2002-06-05cpphash.h (_cpp_create_definition): Update prototype.Neil Booth1-5/+3
* cpphash.h (_cpp_create_definition): Update prototype. (_cpp_push_text_context, _cpp_create_trad_definition): New. ( cpp_lex_identifier_trad): New. (_cpp_set_trad_context): New. * cppinit.c (cpp_finish_options): Don't conditionalize builtins. * cpplib.c (SEEN_EOL): Update. (lex_macro_node): Update for -traditional. (cpp_push_buffer, _cpp_pop_buffer): Similarly. * cppmacro.c (_cpp_create_definition): Split into create_iso_definition() and _cpp_create_trad_definition(). (warn_of_redefinition): Update prototype; handle traditional macros. (_cpp_push_text_context): New. * cpptrad.c (skip_whitespace, push_replacement_text): New. (lex_identifier): Call ht_lookup with correct start. (_cpp_lex_identifier_tradm _cpp_create_trad_definition, _cpp_set_trad_context): New. (scan_out_logical_line): Update to handle changing contexts. From-SVN: r54293
2002-06-02c-common.c (c_common_init): Override cpplib's default warn_long_long setting.Neil Booth1-0/+2
* c-common.c (c_common_init): Override cpplib's default warn_long_long setting. * c-lex.c (lex_number): Replace with interpret_integer, interpret_float, narrowest_unsigned_type and narrowest_signed_type, taking advantage of the new cpplib functionality. * cpperror.c (_cpp_begin_message): If a warning is turned into an error, avoid printing "warning:". * cppexp.c (cpp_num_sign_extend): New. * cppinit.c: Update comment. * cpplib.h (cpp_num_sign_extend): New. * tree.h: Update comment. testsuite: * gcc.dg/wtr-int-type-1.c, gcc.dg/wtr-suffix-1.c, gcc.dg/cpp/paste4.c, gcc.dg/cpp/sysmac2.c: Update for mofified diagnostics. * gcc.dg/c99-intconst-1.c: No longer fail. From-SVN: r54180
2002-05-31cppinit.c (append_include_chain): Always pay attention to cxx_aware when ↵Zack Weinberg1-5/+1
setting new->sysp. * cppinit.c (append_include_chain): Always pay attention to cxx_aware when setting new->sysp. Remove ATTRIBUTE_UNUSED marker on argument. From-SVN: r54124
2002-05-29cppexp.c (cpp_num): Move to cpplib.h.Neil Booth1-0/+3
2002-05-29 Neil Booth <neil@daikokuya.demon.co.uk> Zack Weinberg <zack@codesourcery.com> * cppexp.c (cpp_num): Move to cpplib.h. (CPP_ERROR): Remove. (interpret_float_suffix, interpret_int_suffix): New. (struct suffix, vsuf_1, vsuf_2, vsuf_3): Remove. (cpp_classify_number, cpp_interpret_integer): New. (interpret_number): Remove. (eval_token): Update to use new routines. * cpphash.h (cpp_num_part): Move to cpplib.h. * cppinit.c (cpp_post_options): Set warn_long_long. * cpplib.h (struct cpp_options): Add warn_long_long. (cpp_num, cpp_num_part, CPP_N_CATEGORY, CPP_N_INVALID, CPP_N_INTEGER, CPP_N_FLOATING, CPP_N_WIDTH, CPP_N_SMALL, CPP_N_MEDIUM, CPP_N_LARGE, CPP_N_RADIX, CPP_N_DEC, CPP_N_HEX, CPP_N_OCTAL, CPP_N_UNSIGNED, CPP_N_IMAGINARY, cpp_classify_number, cpp_interpret_integer): New. testsuite: * gcc.dg/cpp/c++98-pedantic.c, gcc.dg/cpp/c89-pedantic.c, gcc.dg/cpp/c94-pedantic.c, gcc.dg/cpp/gnuc89-pedantic.c, gcc.dg/cpp/if-1.c: Update for modified diagnostics. Co-Authored-By: Zack Weinberg <zack@codesourcery.com> From-SVN: r54007
2002-05-27c-common.c (c_common_init): Set CPP arithmetic precision.Neil Booth1-7/+11
* c-common.c (c_common_init): Set CPP arithmetic precision. * cppexp.c (cpp_num_part): Move typedef ... * cpphash.h: ...here; make unsigned HOST_WIDE_INT. * cppinit.c (cpp_create_reader): Default to host long arithmetic. (sanity_checks): Update. testsuite: * gcc.dg/cpp/arith-2.c, gcc.dg/cpp/arith-3.c: New tests. * gcc.dg/cpp/if-3.c: Remove. From-SVN: r53911
2002-05-23cppinit.c (mark_named_operators): Split out from init_builtins.Neil Booth1-10/+22
* cppinit.c (mark_named_operators): Split out from init_builtins. (cpp_finish_options): Call it from here instead. testsuite: * gcc.dg/cpp/named_ops.c: New test. From-SVN: r53803
2002-05-23cpperror.c (_cpp_begin_message): No special casing of CPP_FATAL_LIMIT.Neil Booth1-13/+13
* cpperror.c (_cpp_begin_message): No special casing of CPP_FATAL_LIMIT. * cppinit.c (sanity_checks): s/DL_FATAL/DL_ICE/. (output_deps, cpp_handle_option, cpp_post_options): Use DL_ERROR. * cpplib.c (do_include_common): Use DL_ERROR. * cpplib.h (CPP_FATAL_LIMIT, CPP_FATAL_ERRORS, DL_FATAL): Remove. (DL_ICE): Renumber. * fix-header.c (read_scan_file): Update. From-SVN: r53765
2002-05-22cpperror.c: Fix formatting.Kazu Hirata1-16/+16
* cpperror.c: Fix formatting. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.c: Likewise. * cpphash.h: Likewise. * cppinit.c: Likewise. * cpplex.c: Likewise. * cpplib.c: Likewise. * cppmacro.c: Likewise. * cppmain.c: Likewise. * cppspec.c: Likewise. From-SVN: r53751
2002-05-21c-common.c (c_common_init): Set options->unsigned_char from flag_signed_char.Zack Weinberg1-21/+4
* c-common.c (c_common_init): Set options->unsigned_char from flag_signed_char. (cb_register_builtins): Define __STRICT_ANSI__ and __CHAR_UNSIGNED__ here... * cppinit.c (init_builtins): Not here. (cpp_create_reader): unsigned_char option defaults to 0, not !DEFAULT_SIGNED_CHAR. (COMMAND_LINE_OPTIONS, cpp_handle_option): Lose -fsigned-char and -funsigned-char. * cpphash.h (struct spec_nodes): Kill n__STRICT_ANSI__. * cpphash.c (_cpp_init_hashtable): Don't set it. * cppmacro.c (builtin_macro) [BT_STDC]: Use the language setting directly. Clarify comment. From-SVN: r53703
2002-05-21* cppinit.c (sanity_checks): Avoid printf mismatch warnings.Andreas Jaeger1-4/+6
From-SVN: r53694
2002-05-18cppinit.c (cpp_post_options): If preprocessed, turn off traditional.Neil Booth1-2/+9
* cppinit.c (cpp_post_options): If preprocessed, turn off traditional. If traditional, turn off column numbers. * cpplib.c (cpp_push_buffer): Lex from stage 3 if traditional. * cpptrad.c (handle_newline): Update line_base. (skip_comment): Handle -Wcomment. From-SVN: r53582
2002-05-18cppinit.c (struct builtin): Remove unused fields.Zack Weinberg1-60/+46
* cppinit.c (struct builtin): Remove unused fields. (CPLUS, BUILTIN, OPERATOR, O, builtin_array_end): Kill. (operator_array): New - was second half of builtin_array. (init_builtins): Simplify loop over builtin_array/operator_array. From-SVN: r53574
2002-05-17Makefile.in: Update for cpptrad.c.Neil Booth1-4/+16
* Makefile.in: Update for cpptrad.c. * cpphash.h (struct cpp_buffer): New members for buffer overlays. (struct cpp_reader): New members for traditional output. (_cpp_read_logical_line, _cpp_overlay_buffer): New. * cppinit.c (cpp_create_reader): Set trad_line. (cpp_destroy): Free trad_out_base if used. (cpp_read_main_file): Overlay an empty buffer if traditional. (cpp_finish_options): Don't do builtins. (COMMAND_LINE_OPTIONS): Add -traditional-cpp. (cpp_handle_option): Handle it. * cpplex.c (continue_after_nul): New. (_cpp_lex_direct): Use handle_nul. * cpplib.h (struct cpp_options): New traditional option. * cpptrad.c: New file. From-SVN: r53568
2002-05-17c-common.c (c_common_init_options): Use C89 for Objective-C, and set the ↵Neil Booth1-25/+10
options flag. * c-common.c (c_common_init_options): Use C89 for Objective-C, and set the options flag. * cppinit.c (lang_flags): Remove objc. (lang_defaults): Remove OBJC and OBJCXX. (set_lang): Update. (COMMAND_LINE_OPTIONS): Remove -+ and -lang-objc++. (cpp_handle_option): Remove -+ and -lang-objc++. For ObjC, just set a flag. (print_help): Update. * cpplib.h (enum c_lang): Remove CLK_OBJC and CLK_OBJCXX. From-SVN: r53566
2002-05-16c-common.c (STDC_0_IN_SYSTEM_HEADERS, [...]): Default-define here.Zack Weinberg1-68/+9
* c-common.c (STDC_0_IN_SYSTEM_HEADERS, REGISTER_PREFIX): Default-define here. (builtin_define_with_value): Can now wrap the expansion in quotation marks if such is wanted. (cb_register_builtins): Update calls to builtin_define_with_value. Define __REGISTER_PREFIX__, __USER_LABEL_PREFIX__, and __VERSION__ here. (c_common_init): Set options->stdc_0_in_system_headers. * c-lex.h: Update prototype of builtin_define_with_value. * cppdefault.h: Remove default definitions of USER_LABEL_PREFIX and REGISTER_PREFIX. * cppinit.c (VERS, ULP, C, X): Kill. (builtin_array): Remove entries for __VERSION__, __USER_LABEL_PREFIX__, __REGISTER_PREFIX__, and __HAVE_BUILTIN_SETJMP__. Make __STDC__ always a builtin, not a constant. (init_builtins): Kill off a bunch of now-dead code. (COMMAND_LINE_OPTIONS): Remove -fleading-underscore and -fno-leading-underscore. (cpp_handle_option): Remove code to set user_label_prefix. (cpp_post_options): Likewise. * cpplib.h (struct cpp_options): Remove user_label_prefix. (stdc_0_in_system_headers): New. * cppmacro.c (builtin_macro): Check CPP_OPTION (pfile, stdc_0_in_system_headers) too to decide the value of __STDC__. * tradcpp.c (user_label_prefix): Kill. (main): Remove code handling -f(no-)leading-underscore. (initialize_builtins): Don't define __REGISTER_PREFIX__ or __USER_LABEL_PREFIX__. (install_value): Wrap compound statement in dummy loop so the macro works properly in an if statement. From-SVN: r53525
2002-05-15c-parse.in (MODIFIED_WCHAR_TYPE): New macro.Zack Weinberg1-12/+0
* c-parse.in (MODIFIED_WCHAR_TYPE): New macro. (c_common_nodes_and_builtins): Use it. (builtin_define_with_value): New function. (cb_register_builtins): Define __SIZE_TYPE__, __PTRDIFF_TYPE__, __WCHAR_TYPE__, and __WINT_TYPE__ here, using builtin_define_with_value. Use consistent notation when defining __GXX_WEAK__. (WCHAR_TYPE_SIZE): Don't redefine. (combine_strings): Don't use WCHAR_TYPE_SIZE. * cppdefault.h: Don't provide defaults for SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE, or WINT_TYPE. * cppinit.c (builtin_array): Remove entries for __SIZE_TYPE__ etc. * tradcpp.c (initialize_builtins): Likewise. * gcc.c (cpp_unique_options): Don't muck with __WCHAR_TYPE__. * c-lex.h (builtin_define_with_value): Prototype. * system.h: Poison NO_BUILTIN_SIZE_TYPE, NO_BUILTIN_WCHAR_TYPE, NO_BUILTIN_PTRDIFF_TYPE, and NO_BUILTIN_WINT_TYPE. * doc/tm.texi: Remove mention of NO_BUILTIN_SIZE_TYPE etc. * config/avr/avr.h, config/h8300/h8300.h, config/i386/i386.h, config/ia64/ia64.h, config/mips/dec-osf1.h, config/mips/iris6.h, config/mips/linux.h, config/mips/mips.h, config/mips/netbsd.h, config/mips/osfrose.h, config/mips/sni-svr4.h, config/rs6000/aix51.h, config/s390/linux.h, config/sh/sh.h, config/sh/sh64.h, config/sparc/linux64.h, config/sparc/netbsd-elf.h, config/sparc/sol2-bi.h, config/sparc/sparc.h: Do not define NO_BUILTIN_SIZE_TYPE etc. Remove all references to __SIZE_TYPE__ etc from all spec strings. When this makes extra specs empty, delete them. From-SVN: r53472
2002-05-13Makefile.in (c-common.o, cppinit.o): Update.Neil Booth1-5/+0
* Makefile.in (c-common.o, cppinit.o): Update. * c-common.c: Include except.h. (cb_register_builtins): Handle __USING_SJLJ_EXCEPTIONS__. Call TARGET_CPU_CPP_BUILTINS and TARGET_OS_CPP_BUILTINS. * cppinit.c (__USING_SJLJ_EXCEPTIONS): Not here. * defaults.h (TARGET_OS_CPP_BUILTINS, TARGET_CPU_CPP_BUILTINS, CPP_PREDEFINES): Handle here. config: * alpha/alpha-interix.h, alpha/gnu.h, alpha/linux.h, alpha/netbsd.h, alpha/openbsd.h, alpha/osf.h, alpha/unicosmk.h, alpha/vms.h, alpha/vxworks.h: Remove CPP_PREDEFINES, define TARGET_OS_CPP_BUILTINS. * alpha/alpha.h (TARGET_CPU_CPP_BUILTINS): Define. (CPP_SPEC, EXTRA_SPECS): Update. (CPP_AM_BWX_SPEC, CPP_AM_MAX_SPEC, CPP_AM_FIX_SPEC, CPP_AM_CIX_SPEC, CPP_IM_EV4_SPEC, CPP_IM_EV5_SPEC, CPP_IM_EV6_SPEC, CPP_CPU_EV4_SPEC, CPP_CPU_EV5_SPEC, CPP_CPU_EV56_SPEC, CPP_CPU_PCA56_SPEC, CPP_CPU_EV6_SPEC, CPP_CPU_EV67_SPEC, CPP_CPU_DEFAULT_SPEC, CPP_CPU_SPEC): Remove. doc: * tm.texi (TARGET_REGISTER_CPP_BUILTINS): Remove. (TARGET_OS_CPP_BUILTINS, TARGET_CPU_CPP_BUILTINS): Define. From-SVN: r53410
2002-05-07c-common.c (c_common_init): Set options->unsigned_wchar.Neil Booth1-8/+5
* c-common.c (c_common_init): Set options->unsigned_wchar. * cppinit.c (cpp_create_reader): Default unsigned_wchar, group target dependencies. (init_builtins, cpp_handle_option): Update. * cpplex.c (cpp_interpret_charconst): Update. * cpplib.h (struct cpp_options): Add unsigned_wchar, rename signed_char to unsigned_char, group target dependencies. * defaults.h (WCHAR_UNSIGNED): Remove. * system.h (WCHAR_UNSIGNED, MAX_CHAR_TYPE_SIZE): Poison. config: * freebsd.h, interix.h, alpha/freebsd.h, arm/freebsd.h, i386/386bsd.h, i386/beos-elf.h, i386/bsd386.h, i386/cygwin.h, i386/djgpp.h, i386/freebsd-aout.h, i386/i386-interix.h, i386/win32.h, ia64/freebsd.h, mips/netbsd.h, rs6000/freebsd.h, sh/elf.h, sh/sh.h, sparc/freebsd.h: Remove WCHAR_UNSIGNED. doc: * tm.texi: Remove MAX_CHAR_TYPE_SIZE. From-SVN: r53271
2002-05-06c-common.c (warn_multichar): New.Neil Booth1-0/+1
* c-common.c (warn_multichar): New. (c_common_init): Set CPP's warn_multichar. * c-common.h (warn_multichar): New. * c-decl.c (warn_multichar): Remove. * c-lex.c (lex_charconst): Update. * c-tree.h (warn_multichar): Remove. * cppexp.c (eval_token): Sign-extend charconst value. * cppinit.c (cpp_create_reader): Set warn_multichar. * cpplex.c (cpp_interpret_charconst): Don't sign-extend each character. Update prototype. Sign-extend the result. * cpplib.h: Fix conditions. (struct cpp_options): Add new warning flag. (cpp_interpret_charconst): Update prototype. cp: * Make-lang.in (decl2.o): Update. * cp-tree.h (warn_multichar): Remove. * decl2.c: Include c-common.h. (warn_multichar): Remove. doc: * cpp.texi: Update documentation. testsuite: * gcc.dg/cpp/charconst-3.c: Correct tests accordingly. From-SVN: r53240
2002-05-05c-common.c (c_common_init): Set up CPP arithmetic.Neil Booth1-40/+51
* c-common.c (c_common_init): Set up CPP arithmetic. * cppinit.c (cpp_create_reader): Default CPP arithmetic to something reasonable for the host. (sanity_checks): Add checks. (cpp_read_main_file): Call sanity_checks() from here... (cpp_post_options): ... not here. * cpplex.c (cpp_interpret_charconst): Get max_chars right. * cpplib.h (struct cpp_options): New member int_precision. testsuite: * gcc.dg/cpp/charconst.c: Update tests. From-SVN: r53186
2002-05-04Makefile.in (c-lex.o): Update.Neil Booth1-7/+5
* Makefile.in (c-lex.o): Update. * c-lex.c: Include target.h. (cb_register_builtins): New. (init_c_lex): Set builtins callback. * c-lex.h (cpp_define, cpp_assert): New prototypes. * cppinit.c (init_builtins): Use callback, including for GXX_WEAK. * cpplib.h (struct cpp_callbacks): New member. * target-def.h (TARGET_REGISTER_CPP_BUILTINS): New. (TARGET_INITIALIZER): Update. * target.h (struct gcc_target): New hook. * tree.c (default_register_cpp_builtins): New. * tree.h (default_register_cpp_builtins): New. doc: * tm.texi (TARGET_REGISTER_CPP_BUILTINS): Document. From-SVN: r53165
2002-05-04cppinit.c (MAX_WCHAR_TYPE_SIZE): Move to cpplib.hNeil Booth1-24/+34
* cppinit.c (MAX_WCHAR_TYPE_SIZE): Move to cpplib.h (cpp_post_options): Move sanity checks to... (sanity_checks): New. * cpplex.c (maybe_read_ucs): Fix prototype. (parse_string, cpp_parse_escape): Cast for %c format specifier. * cpplib.h (cppchar_t): Use unsigned long or unsigned long long if necessary. From-SVN: r53163
2002-05-04c-lex.c (lex_string): Let cpp_parse_escape handles truncation and ↵Neil Booth1-0/+33
sign-extension. * c-lex.c (lex_string): Let cpp_parse_escape handles truncation and sign-extension. (lex_charconst): Update for change in prototype of cpp_interpret_charconst. Extend from cppchar_t to HOST_WIDE_INT appropriately. * cpphash.h (BITS_PER_CPPCHAR_T): New. * cppinit.c (cpp_create_reader): Initialize them for no change in semantics. (cpp_post_options): Add sanity checks. * cpplex.c (cpp_parse_escape): Handle precision, sign-extension and truncation issues. Calculate in type cppchar_t. (MAX_CHAR_TYPE_SIZE, MAX_WCHAR_TYPE_SIZE): Remove. (cpp_interpret_charconst): Calculate in type cppchar_t. Handle run-time dependent precision correctly. Return whether the result is signed or not. * cpplib.c (dequote_string): Use cppchar_t; update. * cpplib.h (cppchar_signed_t): New. struct cpp_options): New precision members. (cpp_interpret_charconst, cpp_parse_escape): Update prototypes. From-SVN: r53152
2002-05-01cppinit.c (cpp_handle_option): Don't set no_output here...Jakub Jelinek1-1/+15
* cppinit.c (cpp_handle_option) [-dM]: Don't set no_output here... (cpp_post_options): ...but here. Disable -dD, -dN and -dI when -M -or -MM is in effect. From-SVN: r53013
2002-04-28cppexp.c (lex): Update to use state.skip_eval.Neil Booth1-0/+4
* cppexp.c (lex): Update to use state.skip_eval. (struct op): Remove prio and flags members. (FLAG_BITS, FLAG_MASK, PRIO_SHIFT, EXTRACT_PRIO, EXTRACT_FLAGS, SHORT_CIRCUIT, RIGHT_ASSOC, ..._PRIO, op_to_prio): Remove. (LEFT_ASSOC): New macro. (optab): New table of operator priorities and flags. (SHIFT): Update. (_cpp_parse_expr): Clean up logic. Return bool. Use a malloc-ed parser stack. (reduce): New; reduce the operator stack. (_cpp_expand_op_stack): Expand the operator stack as necessary. * cpphash.h (struct op): Predeclare. (struct cpp_reader): New members op_stack, op_limit. (struct lexer_state): New member skip_eval. (_cpp_parse_expr): Update. (_cpp_expand_op_stack): New. * cpplib.c (do_if): Update. * cppinit.c (cpp_create_reader): Create op stack. (cpp_destroy): And destroy it. * cpplib.h (CPP_LAST_CPP_OP): Correct. (TTYPE_TABLE): Correct. testsuite: * gcc.dg/cpp/if-mop.c: Update. * gcc.dg/cpp/if-mpar.c: Add test. * gcc.dg/cpp/if-oppr.c: Update. From-SVN: r52853
2002-04-22cppfiles.c (_cpp_pop_file_buffer): Return void.Neil Booth1-47/+29
* cppfiles.c (_cpp_pop_file_buffer): Return void. Move file change and include code to _cpp_pop_buffer. * cpphash.h (struct pending_option): Predeclare. (struct cpp_reader): New member next_include_file. (_cpp_pop_file_buffer): Update. (_cpp_push_next_buffer): Update, rename. * cppinit.c (cpp_destroy): Free include chain and pending here. (cpp_finish_options): Simplify. (_cpp_push_next_buffer): Rename and clean up. * cpplib.c (cpp_pop_buffer): Move code from _cpp_pop_file_buffer. Clarify. * cppmacro.c (cpp_scan_nooutput): Set return_at_eof here. From-SVN: r52621
2002-04-21cppexp.c (struct op, [...]): Replace U_CHAR with uchar.Neil Booth1-3/+3
* cppexp.c (struct op, parse_number): Replace U_CHAR with uchar. * cppfiles.c (read_include_file): Similarly. * cpphash.h (DSC, U_CHAR, ustrcmp, ustrncmp, ustrlen, uxstrdup ustrchr, ufputs): Similarly. * cppinit.c (TRIGRAPH_MAP, cpp_destroy): Similarly. * cpplex.c (parse_slow, unescaped_terminator_p, save_comment, cpp_ideq, parse_identifier, parse_number): Similarly. * cpplib.c (struct directive, dequote_string, D, run_directive, cpp_push_buffer): Similarly. * cppmacro.c (new_string_token, builtin_macro, cpp_quote_string, _cpp_create_definition, check_trad_stringification, cpp_macro_definition): Similarly. From-SVN: r52587
2002-04-14cpperror.c (print_location): Don't print include chain if line == 0.Neil Booth1-17/+20
* cpperror.c (print_location): Don't print include chain if line == 0. (cpp_begin_message): Update to use DL_ macros. (cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_notice, cpp_notice_from_errno): Remove. (cpp_error, cpp_error_with_line): Update to take a diagnostic level. (cpp_errno): New. * cppexp.c (CPP_ICE): Remove. (SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined, lex, integer_overflow, _cpp_parse_expr): Update. * cppfiles.c (read_include_file, find_include_file, handle_missing_header, _cpp_read_file, remap_filename): Update. * cpphash.h (enum error_type): Remove. (_cpp_begin_message): Update. * cppinit.c (append_include_chain, remove_dup_dirs, output_deps, cpp_handle_option, cpp_post_options): Update. * cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment, skip_whitespace, parse_identifier, parse_slow, parse_string, _cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape, cpp_interpret_charconst): Update. * cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive, lex_macro_node, do_undef, glue_header_name, parse_include, do_include_common, read_flag, do_line, do_linemarker, do_ident, cpp_register_pragma, do_pragma_once, do_pragma_system_header, do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else, do_elif, do_endif, parse_answer, parse_assertion, do_assert, _cpp_pop_buffer, do_diagnostic): Update. * cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR, DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New. (cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_notice, cpp_notice_from_errno): Remove. (cpp_error, cpp_error_with_line): Update to take a diagnostic level. (cpp_errno): New. * cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens, collect_args, enter_macro_context, save_parameter, parse_params, _cpp_create_definition, check_trad_stringification, cpp_macro_definition): Update. * cppmain.c (cpp_preprocess_file): Update. * fix-header.c (read_scan_file): Update. From-SVN: r52302
2002-04-07cppinit.c (cpp_create_reader): Initialize discard_comments_in_macro_exp.Jason Thorpe1-0/+6
* cppinit.c (cpp_create_reader): Initialize discard_comments_in_macro_exp. (COMMAND_LINE_OPTIONS): Add "-CC" option. (cpp_handle_option): Handle "-CC" option. * cpplex.c (save_comment): If saving a C++ comment in a directive, convert it to a C comment. (_cpp_lex_direct): Pass second comment start character to save_comment to indicate comment type. * cpplib.c (_cpp_handle_directive): If processing a "#define" directive and discard_comments_in_macro_exp is false, re-enable saving of comments. (lex_macro_node): If discard_comments_in_macro_exp is false, discard any comments before the macro identifier. * cpplib.h (struct cpp_options): Add discard_comments_in_macro_exp member. * cppmacro.c (cpp_get_token): If expanding a macro while processing a directive, discard any comments we might encounter. (parse_params): If discard_comments_in_macro_exp is false, ignore comments in the macro parameter list. * gcc.c (cpp_unique_options): Add "-CC" option. (option_map): Map "--comments-in-macros" to "-CC". * doc/cppopts.texi: Document "-CC" option. * f/lang-specs.h: Add "-CC" option. * testsuite/gcc.dg/cpp/maccom1.c: New test. * testsuite/gcc.dg/cpp/maccom2.c: New test. * testsuite/gcc.dg/cpp/maccom3.c: New test. * testsuite/gcc.dg/cpp/maccom4.c: New test. * testsuite/gcc.dg/cpp/maccom5.c: New test. * testsuite/gcc.dg/cpp/maccom6.c: New test. From-SVN: r51975
2002-03-24gcc.c (cpp_options): Pass -MD through as -MD not -M -MF.Neil Booth1-10/+6
preprocessor/3951 * gcc.c (cpp_options): Pass -MD through as -MD not -M -MF. * cppinit.c (cpp_handle_option): Set no_ouput if -MD or -MMD. (init_dependency_output): Don't make no_output decision here. From-SVN: r51272
2002-03-24cppinit.c (cpp_handle_option): Set warn_endif_labels if -pedantic here...Neil Booth1-4/+1
* cppinit.c (cpp_handle_option): Set warn_endif_labels if -pedantic here... (cpp_post_options): ... not here. From-SVN: r51258
2002-03-22cpplib.h (struct cpp_options): New member, warn_endif_labels.Phil Edwards1-0/+9
2002-03-22 Phil Edwards <pme@gcc.gnu.org> * cpplib.h (struct cpp_options): New member, warn_endif_labels. * cppinit.c (cpp_create_reader): On by default. (cpp_handle_option): Handle -W[no-]endif-labels. (cpp_post_options): Also enable if -pedantic. * cpplib.c (do_else): Use it. (do_endif): Likewise. * doc/cppopts.texi: Document new option. * doc/invoke.texi: Document new option. From-SVN: r51190
2002-03-16* cppinit.c: Revert -MD removal.Neil Booth1-0/+17
From-SVN: r50884
2002-03-16cppinit.c (print_help): Display -MD and -MMD.Neil Booth1-21/+5
* cppinit.c (print_help): Display -MD and -MMD. Don't display usage string. Update assertion syntax and typo. (COMMAND_LINE_OPTIONS): Remove OPT_MD, OPT_MMD. (cpp_handle_option): Update. From-SVN: r50874
2002-03-10re PR preprocessor/5899 (-M disables -dM)Neil Booth1-6/+4
PR preprocessor/5899 * cppinit.c (init_dependency_output): Don't ignore -dM etc. From-SVN: r50545
2002-03-03attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit ↵Kaveh R. Ghazi1-2/+1
sizeof/sizeof. * attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * i386.c (override_options, ix86_init_mmx_sse_builtins, ix86_expand_builtin): Likewise. * mips.c (mips_add_gc_roots): Likewise. * mmix.c (mmix_output_condition): Likewise. * rs6000.c (rs6000_override_options, altivec_expand_builtin, altivec_init_builtins): Likewise. * sparc.c (mark_ultrasparc_pipeline_state): Likewise. * cppexp.c (Nsuff, parse_number): Likewise. * cppinit.c (builtin_array_end): Likewise. * gcc.c (n_default_compilers, process_command): Likewise. * genpreds.c (output_predicate_decls): Likewise. * ggc-page.c (NUM_EXTRA_ORDERS): Likewise. * lcm.c (N_ENTITIES): Likewise. * stor-layout.c (set_sizetype): Likewise. ada: * utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. cp: * decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * decl2.c (cxx_decode_option): Likewise. * lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise. java: * class.c (init_class_processing): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * decl.c (java_init_decl_processing): Likewise. * jcf-parse.c (init_jcf_parse): Likewise. * parse.y (init_src_parse): Likewise. From-SVN: r50255
2002-02-23cppinit.c (output_deps): Correct test for stdout output.Neil Booth1-7/+7
* cppinit.c (output_deps): Correct test for stdout output. (init_dependency_output): Cure warning. From-SVN: r49993
2002-02-20cppinit.c (init_dependency_output): Take deps output file from -o if none ↵Neil Booth1-14/+16
given with -MF. * cppinit.c (init_dependency_output): Take deps output file from -o if none given with -MF. Suppress normal output. * gcc.c (cpp_unique_options): Have -M and -MM imply -E. * doc/cpp.texi, doc/invoke.texi: Update. From-SVN: r49892
2002-02-17cppinit.c (merge_include_chains): Check for brack being NULL before ↵Zack Weinberg1-1/+2
attempting to merge it with qtail. * cppinit.c (merge_include_chains): Check for brack being NULL before attempting to merge it with qtail. From-SVN: r49814
2002-02-02cpphash.h (struct spec_nodes): Remove n__CHAR_UNSIGNED__.Neil Booth1-0/+16
* 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
2002-01-29re PR other/1502 (Nonexistent -W options not diagnosed)Jakub Jelinek1-2/+6
PR other/1502: * cppinit.c (cpp_handle_option): Add ignore argument, if it is zero, don't ignore unrecognized -W* options. (cpp_handle_options): Pass 1 as last argument to cpp_handle_option. * cpplib.h (cpp_handle_option): Adjust prototype. * c-decl.c (c_decode_options): Pass 0 as last argument to cpp_handle_option. PR c/2896: * gcc.c (cpp_unique_options): Split from cpp_options. (cpp_options): Source cpp_unique_options. (default_compilers): Use cpp_unique_options instead of cpp_options when used together with cc1_options. (static_specs): Add cpp_unique_options. * objc/lang-specs.h: Use cpp_unique_options instead of cpp_options when used together with cc1_options. * decl2.c (cxx_decode_option): Pass 0 as last argument to cpp_handle_option. * lang-specs.h: Use cpp_unique_options instead of cpp_options when used together with cc1_options. From-SVN: r49315