Commit Graph

106 Commits

Author SHA1 Message Date
Neil Booth
38800fe876 re PR preprocessor/7150 (gcc -dM -E ... SegFault)
PR preprocessor/7150
	* cppmain.c (scan_translation_unit_trad): Simplify.
	* cpplib.c (cpp_scan_nooutput): Handle traditional case.

From-SVN: r55102
2002-06-29 15:49:24 +00:00
Neil Booth
278c466207 cpphash.h (struct cpp_reader): Make date and time strings.
* 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-19 05:40:08 +00:00
Neil Booth
b66377c173 cpphash.h (_cpp_lex_identifier_trad): Remove.
* cpphash.h (_cpp_lex_identifier_trad): Remove.
	* cpplib.c (end_directive): Don't skip, always remove overlay
	apart from #define.
	(prepare_directive_trad): Handle NULL pfile->directive.
	(_cpp_handle_directive): Always call prepare_directive_trad
	if traditional.
	* cppmain.c (check_multiline_token): Rename account_for_newlines,
	generalize inputs.
	(scan_translation_unit_trad): Use it.
	* cpptrad.c (skip_comment): Rename copy_comment, copy comment to
	output, get escaped newline in comment close correct.
	(check_output_buffer, skip_whitespace): Update.
	(_cpp_lex_identifier_trad): Remove.
	(scan_out_logical_line): Handle -C and comments in directives
	properly.

From-SVN: r54599
2002-06-13 21:16:00 +00:00
Neil Booth
1a76916c78 Makefile.in: Update cppmain.o.
* 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-11 05:36:17 +00:00
Neil Booth
afb03408e0 cpphash.h (_cpp_read_logical_line_trad, [...]): Update prototypes.
* cpphash.h (_cpp_read_logical_line_trad,
	_cpp_expansions_different_trad): Update prototypes.
	* cpplex.c (continue_after_nul): New.
	* cppmain.c: Include cpphash.h.
	(scan_translation_unit_trad): New.
	(cpp_preprocess_file): Call it.
	* cpptrad.c (_cpp_read_logical_line_trad): Take new parameter
	overlay.
	(_cpp_expansions_different_trad): Update prototype.

From-SVN: r54446
2002-06-10 17:20:30 +00:00
Kazu Hirata
df38348381 cpperror.c: Fix formatting.
* 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-22 22:02:16 +00:00
Neil Booth
ebef4e8ca7 cpperror.c (print_location): Don't print include chain if line == 0.
* 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-14 18:42:47 +00:00
Neil Booth
aaf9320682 Removal of separate preprocessor cpp0.
* Makefile.in (GCC_PASSES, STAGESTUFF, LIBCPP_OBJS,
	cpp0, install-common): Update.
	* c-common.c (flag_preprocess_only): New.
	(c_common_init): Preprocess for -E.
	* c-common.h (flag_preprocess_only): New.
	* c-decl.c (c_decode_option): Handle -E, and -std=c++98.
	* c-objc-common.c (c_init_decl_processing): Exit quickly
	for NULL return from c_common_init.
	* cpplib.h (cpp_preprocess_file): New.
	* cppmain.c (main, general_init, pfile, progname): Remove.
	(do_preprocessing): Rename cpp_preprocess_file, don't call
	cpp_finish.  Don't close stdout here.
	(setup_callbacks): Update prototype.
	* gcc.c (trad_capable_cpp, cpp_unique_options, default_compilers):
	Update.
	* tradcpp.c (main): Ignore -quiet.
cp:
	* decl2.c (cxx_decode_option): Handle -E.
	* lang-specs.h (default_compilers): Preprocess with cc1plus.
	* lex.c (cxx_init): Exit quickly if c_common_init returns NULL.
objc:
	* lang-specs.h (default_compilers): Preprocess with cc1obj.

Co-Authored-By: Aldy Hernandez <aldyh@redhat.com>

From-SVN: r51256
2002-03-24 12:27:45 +00:00
Neil Booth
d4e6133f20 cpphash.h (struct cpp_reader): Remove mls_line and mls_col.
* cpphash.h (struct cpp_reader): Remove mls_line and mls_col.
        * cpplex.c (unterminated): Delete.
        (parse_string): No string literal may extend over multiple
        lines.  Suppress the error when preprocessing assembly.
	* cppmain.c (scan_translation_unit): Strings are single-line.

        * doc/cpp.texi: Update to match.
        * testsuite/gcc.dg/cpp/multiline.c: Update to match.

From-SVN: r51195
2002-03-22 22:29:07 +00:00
Zack Weinberg
dcc229e5a1 cpphash.h (struct lexer_state): Remove line_extension member.
* cpphash.h (struct lexer_state): Remove line_extension member.
	* cpplib.c (dequote_string, do_linemarker): New functions.
	(linemarker_dir): New data object.
	(DIRECTIVE_TABLE): No longer need to interpret #line in
	preprocessed source.  Delete obsolete comment about return
	values of handlers.
	(end_directive, directive_diagnostics, _cpp_handle_directive):
	Don't muck with line_extension.
	(directive_diagnostics): No need to issue warnings for
	linemarkers here.
	(_cpp_handle_directive): Issue warnings for linemarkers here,
	when appropriate.  Dispatch linemarkers to do_linemarker, not
	do_line.
	(do_line): Code to handle linemarkers split out to do_linemarker.
	Convert escape sequences in filename argument, both places.

	* cppmacro.c (quote_string): Rename cpp_quote_string and
	export.  All callers changed.
	* cpplib.h (cpp_quote_string): Prototype.
	* cppmain.c (print_line): Call cpp_quote_string on to_file
	before printing it.

	* doc/cpp.texi: Document that escapes are now interpreted in
	#line and in linemarkers, and that non-printing characters are
	converted to octal escapes when linemarkers are generated.

From-SVN: r50779
2002-03-14 18:17:18 +00:00
Zack Weinberg
c7544dd8fd cppmain.c (setup_callbacks): Disable #pragma and #ident callbacks when processing assembly language.
* cppmain.c (setup_callbacks): Disable #pragma and #ident
	callbacks when processing assembly language.

From-SVN: r50346
2002-03-06 07:50:03 +00:00
Neil Booth
5d8ebbd862 cpperror.c: Update comments and copyright.
* cpperror.c: Update comments and copyright.
	* cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
	cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.

From-SVN: r48522
2002-01-03 21:43:09 +00:00
Neil Booth
d15a58c0f1 cppmacro.c: Don't include intl.h.
* cppmacro.c: Don't include intl.h.  Update comments.
	(new_number_token): Allocate enough buffer for 64-bit unsigned
	integers; update prototype.
	* cppmain.c: Update comments.

From-SVN: r48518
2002-01-03 18:32:55 +00:00
Neil Booth
1f978f5f7e c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics.
* c-decl.c (duplicate_decls, push_parm_decl): Remove leading
	capital from diagnostics.
	* c-lex.c (cb_file_change): Similarly.
	* c-parse.in : Similarly.
	* cfgrtl.c (verify_flow_info): Similarly.
	* collect2.c: Similarly.
	* cppfiles.c (find_include_file): Similarly.
	* cppinit.c (cpp_handle_option): Similarly.
	* cpplex.c (cpp_spell_token): Similarly.
	* cppmain.c (do_preprocessing): Similarly.
	* gcc.c (translate_options, process_command, do_spec1,
	main, pfatal_execute): Similarly.
	* genattr.c (main): Similarly.
	* genattrtab.c (check_attr_test, operate_exp, simplify_test_exp,
	write_test_expr, main): Similarly.
	* gencodes.c (main): Similarly.
	* genconfig.c (main): Similarly.
	* genconstants.c (main): Similarly.
	* genemit.c (main): Similarly.
	* genextract.c (main): Similarly.
	* genflags.c (main): Similarly.
	* genopinit.c (main): Similarly.
	* genoutput.c (process_template, main): Similarly.
	* genpeep.c (main): Similarly.
	* genrecog.c (main): Similarly.
	* gensupport.c (is_predicable, identify_predicable_attribute,
	alter_predicate_for_insn, init_md_reader_args, main): Similarly.
	* ggc-page.c (alloc_anon): Similarly.
	* mips-tfile.c (add_string, add_procedure, add_file, read_line,
	parse_begin, parse_bend, parse_def, parse_end, parse_file,
	parse_stabs_common, parse_stabs, write_varray, write_object,
	read_seek, copy_object, main, error): Similarly.
	* profile.c (compute_branch_probabilities): Similarly.
	* reg-stack.c (check_asm_stack_operands): Similarly.
	* reload.c (find_reloads): Similarly.
	* reload1.c (spill_failure, failed_reload): Similarly.
	* rtl-error.c (_fatal_insn_not_found): Similarly.
	* toplev.c (read_integral_parameter, crash_signal,
	decode_f_option, set_target_switch, parse_options_and_default_flags)
	: Similarly.
	* tradcif.y (parse_number, yylex): Similarly.
	* tradcpp.c (main, fancy_abort): Similarly.
	* tree.c (tree_check_failed): Similarly.
	* varray.c (varray_check_failed): Similarly.
	* xcoffout.c (xcoff_output_standard_types): Similarly.
cp:
	* call.c (build_java_interface_fn_ref): Similarly.
	* except.c (is_admissible_throw_operand): Similarly.
	* init.c (build_java_class_ref): Similarly.
	* xref.c (open_xref_file): Similarly.
objc:
	* objc-act.c (get_object_ref, lookup_and_install_protocols,
	build_objc_string_object, objc_declare_alias, build_ivar_chain,
	finish_message_expr, build_protocol_expr, is_public,
	start_class): Similarly.
testsuite:
	* objc.dg/alias.m: Update.
	* objc.dg/class-1.m: Update.
	* objc.dg/const-str-1.m: Update.
	* objc.dg/fwd-proto-1.m: Update.
	* objc.dg/id-1.m: Update.
	* objc.dg/super-class-1.m: Update.

From-SVN: r47518
2001-12-02 00:04:36 +00:00
Joseph Myers
a1f300c0f1 ChangeLog.0, [...]: Fix spelling errors.
* ChangeLog.0, ChangeLog.2, ChangeLog.3, ChangeLog.4, ChangeLog,
	FSFChangeLog.10, c-decl.c, cppfiles.c, cppinit.c, cpplex.c,
	cpplib.c, cppmain.c, cse.c, df.c, diagnostic.c, dominance.c,
	dwarf2out.c, dwarfout.c, emit-rtl.c, errors.c, except.c, except.h,
	explow.c, function.c, gcse.c, genrecog.c, predict.c, regmove.c,
	sched-rgn.c, ssa-ccp.c, stmt.c, toplev.c: Fix spelling errors.

From-SVN: r47279
2001-11-23 02:05:19 +00:00
Neil Booth
f5e99456f1 c-common.c: Include c-lex.h.
* c-common.c: Include c-lex.h.
	(c_common_lang_init): Change prototype.  Call init_c_lex and
	init_pragma from here.
	* c-common.h (c_common_lang_init): Change prototype.
	* c-decl.c (init_decl_processing): Rename.  Call c_parse_init.
	* c-lang.c (c_init): Change prototype.  Update.
	(c_init_options): Update.
	* c-lex.c (cpp_filename): Remove.
	(init_c_lex): Update.  Read the main file, and get the original
	file name.
	(yyparse): Finish the command line options.
	* c-parse.in (c_parse_init): Call init_reswords here.
	(init_parse): Remove.
	* c-tree.h (c_init_decl_processing): New.
	* cpphash.c (_cpp_init_hashtable): After initializing the hash
	table, populate it.
	* cppinit.c (read_original_filename, cpp_finish_options): New.
	(cpp_create_reader): New prototype. Defer hash table initialization.
	(cpp_start_read): Rename cpp_read_main_file.  Initialize the
	hash table.  Get the original filename.
	* cpplib.h (cpp_create_reader): Update.
	(cpp_start_read): Remove.
	(cpp_read_main_file, cpp_finish_options): New.
	* cppmain.c (main, do_preprocessing): Update.
	* langhooks.h (struct langhooks): Update init prototype.
	* toplev.c (general_init, parse_options_and_default_flags,
	process_options, lang_indpendent_init, lang_dependent_init,
	init_asm_output): New; perform the bulk of initialization.
	(compile_file): Move most of initialization to above functions.
	(debug_hooks): Initialize statically.
	(set_Wunused): Relocate.
	(toplev_main): Move most of initialization to other init functions.
	Have a clear logic flow.
	* tree.h (init_parse, init_decl_processing): Remove.
ada:
	* misc.c (gnat_init): Change prototype.  Include the
	functionality of the old init_parse and init_decl_processing.
	(gnat_init_decl_processing): New prototype.
	(init_parse): Remove.
	* utils.c (init_decl_processing): Rename gnat_init_decl_processing.
cp:	* cp-tree.h (init_reswords, cxx_init_decl_processing): New.
	(cxx_init): Update prototype.
	* decl.c (init_decl_processing): Rename.  Move null node init
	to its creation time.
	* lex.c (cxx_init_options): Update.
	(cxx_init): Combine with old init_parse; also call
	cxx_init_decl_processing.
f:	* com.c (ffecom_init_decl_processing): Renamed from
	init_decl_processing.
	(init_parse): Move contents to ffe_init.
	(ffe_init): Update prototype.
java:	* decl.c (init_decl_processing): Rename java_init_decl_processing.
	* java-tree.h: New prototype.
	* lang.c (java_init): Update prototype.  Combine with old init_parse.
objc:	* objc-act.c (objc_init): Update prototype, combine with old
	init_parse.
	(objc_init_options): Update.

From-SVN: r47046
2001-11-15 10:01:10 +00:00
Kaveh R. Ghazi
9e1ac9154a cppexp.c (parse_number): Use ISXDIGIT/hex_value.
* cppexp.c (parse_number): Use ISXDIGIT/hex_value.
	* cpplex.c (hex_digit_value): Use hex_p/hex_value.
	* cppmain.c (general_init): Call hex_init.

From-SVN: r46912
2001-11-10 04:46:01 +00:00
Zack Weinberg
191bf46407 aclocal.m4 (AM_WITH_NLS): AC_DEFINE HAVE_LIBINTL_H and USE_INCLUDED_LIBINTL when appropriate.
* aclocal.m4 (AM_WITH_NLS): AC_DEFINE HAVE_LIBINTL_H and
	USE_INCLUDED_LIBINTL when appropriate.
	* configure, config.in: Regenerate.
	* Makefile.in (datadir): Set to @datadir@.
	(intl.o): Also depend on $(CONFIG_H) and system.h.

	* intl.c: Factor out common gettext initialization sequence.
	(gcc_init_libintl):  New function.
	* intl.h: Include intl/libgnuintl.h if USE_INCLUDED_LIBINTL;
	otherwise include libintl.h if HAVE_LIBINTL_H; otherwise turn
	off NLS.  Add multiple include guard.  No need to #ifdef-guard
	an #undef.  Prototype gcc_init_libintl here.

	* collect2.c (main), cppmain.c (general_init), gcc.c (main),
	gcov.c (main), protoize.c (main), toplev.c (toplev_main):
	Use gcc_init_libintl.

intl:
	* Makefile.in: Don't copy libgnuintl.h anywhere.

From-SVN: r46348
2001-10-19 15:17:39 +00:00
Neil Booth
0c34509f6d cppmain.c (struct printer): New member source.
* cppmain.c (struct printer): New member source.
	(scan_translation_unit): Fix spacing at start of lines.
	(cb_line_change): Update.

	* gcc.dg/cpp/spacing2.c: New test.

From-SVN: r46237
2001-10-12 22:31:04 +00:00
Neil Booth
644eddaac5 cpphash.h: Update comments.
* cpphash.h: Update comments.
	(cpp_context): Update.
	(spec_nodes): Remove n__Pragma.
	* cppinit.c (cpp_create_reader): Update.
	(builtin_array): Add _Pragma.
	* cpplib.h: Update comments.
	(NODE_DISABLED, BT_PRAGMA): New.
	(cpp_start_lookahead, cpp_stop_lookahead): Remove prototypes.
	* cppmacro.c (struct cpp_macro): Remove disabled.
	(builtin_macro): Return int, handle _Pragma, push the new token
	on the context stack.
	(funlike_invocation_p): Unconstify, update.
	(enter_macro_context): Handle builtins here.
	(replace_args, push_token_context, push_ptoken_context):
	Update for prototype changes.
	(_cpp_pop_context): Update.
	(cpp_get_token): Don't handle buitins, nor _Pragma here.
	(cpp_sys_macro_p): Update.
	(_cpp_free_definition): Clear disabled flag.
	(_cpp_create_definition): Upate.
	* cppmain.c: Update comments.

From-SVN: r45948
2001-10-02 12:57:24 +00:00
Neil Booth
4ed5bcfb1e c-lex.c (cb_def_pragma): Update.
* c-lex.c (cb_def_pragma): Update.
	(c_lex): Update, and skip padding.
	* cppexp.c (lex, parse_defined): Update, remove unused variable.
	* cpphash.h (struct toklist): Delete.
	(union utoken): New.
	(struct cpp_context): Update.
	(struct cpp_reader): New members eof, avoid_paste.
	(_cpp_temp_token): New.
	* cppinit.c (cpp_create_reader): Update.
	* cpplex.c (_cpp_temp_token): New.
	(_cpp_lex_direct): Add PREV_WHITE when parsing args.
	(cpp_output_token): Don't print leading whitespace.
	(cpp_output_line): Update.
	* cpplib.c (glue_header_name, parse_include, get__Pragma_string,
	do_include_common, do_line, do_ident, do_pragma,
	do_pragma_dependency, _cpp_do__Pragma, parse_answer,
	parse_assertion): Update.
	(get_token_no_padding): New.
	* cpplib.h (CPP_PADDING): New.
	(AVOID_LPASTE): Delete.
	(struct cpp_token): New union member source.
	(cpp_get_token): Update.
	* cppmacro.c (macro_arg): Convert to use pointers to const tokens.
	(builtin_macro, paste_all_tokens, paste_tokens, funlike_invocation_p,
	replace_args, quote_string, stringify_arg, parse_arg, next_context,
	enter_macro_context, expand_arg, _cpp_pop_context, cpp_scan_nooutput,
	_cpp_backup_tokens, _cpp_create_definition): Update.
	(push_arg_context): Delete.
	(padding_token, push_token_context, push_ptoken_context): New.
	(make_string_token, make_number_token): Update, rename.
	(cpp_get_token): Update to handle tokens as pointers to const,
	and insert padding appropriately.
	* cppmain.c (struct printer): New member prev.
	(check_multiline_token): Constify.
	(do_preprocessing, cb_line_change): Update.
	(scan_translation_unit): Update to handle spacing.
	* scan-decls.c (get_a_token): New.
	(skip_to_closing_brace, scan_decls): Update.
	* fix-header.c (read_scan_file): Update.

	* doc/cpp.texi: Update.

	* gcc.dg/cpp/macro10.c: New test.
	* gcc.dg/cpp/strify3.c: New test.
	* gcc.dg/cpp/spacing1.c: Add tests.
	* gcc.dg/cpp/19990703-1.c: Remove bogus test.
	* gcc.dg/cpp/20000625-2.c: Fudge to pass.

From-SVN: r45793
2001-09-24 22:53:12 +00:00
Neil Booth
18a9d8ff7f cppmain.c (scan_translation_unit): Don't worry about putting a space after hashes.
* cppmain.c (scan_translation_unit): Don't worry about
	putting a space after hashes.
	* cpplib.c (directive_diagnostics): New.
	(_cpp_handle_directive): Update to use directive_diagnostics.
	(run_directive): Don't toggle prevent_expansion.
	(do_line): Backup in case of the line extension.
	* cpplib.h (cpp_lexer_pos): Remove.
	* cppmacro.c (_cpp_create_definition): Precede a leading #
	with whitespace.

	* gcc.dg/cpp/line5.c: New testcase.

From-SVN: r45645
2001-09-16 11:23:56 +00:00
Neil Booth
f0581dc714 cppmain.c (setup_callbacks): Set line callback only if outputting preprocessed source.
* cppmain.c (setup_callbacks): Set line callback only
	if outputting preprocessed source.

From-SVN: r45632
2001-09-15 16:33:43 +00:00
Neil Booth
9729389786 cpperror.c (print_location): Take line and column, for default positioning use the previously lexed token.
* cpperror.c (print_location): Take line and column, for
	default positioning use the previously lexed token.
	(_cpp_begin_message): Take line and column.
	(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
	cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update.
	* cpphash.h (_cpp_begin_message): Update prototype.
	* cppinit.c (push_include): Don't set output line.
	* cpplex.c (_cpp_lex_token): Callback for start of new output lines.
	* cpplib.c (do_diagnostic, _cpp_pop_buffer): Update.
	(do_pragma): Kludge for front ends.  Don't expand macros at all.
	* cpplib.h (cpp_lookahead, cpp_token_with_pos, cpp_get_line): Remove.
	(struct cpp_token): Remove output_line.
	(struct cpp_callbacks): New member line_change.
	* cppmacro.c (builtin_macro, paste_all_tokens, replace_args,
	cpp_get_token): Preserve BOL flag.
	(cpp_get_line): Remove.
	(_cpp_backup_tokens): Remove useless abort().
	* cppmain.c (cb_line_change): New.
	(scan_translation_unit): Don't worry about starting new lines here.
	* scan-decls.c (scan_decls): Update.
	* c-lex.c (c_lex, init_c_lex): Update.
	(cb_line_change, src_lineno): New.

From-SVN: r45613
2001-09-14 22:04:46 +00:00
Neil Booth
d7bc7a9850 cpphash.h (_cpp_push_next_buffer): New.
* cpphash.h (_cpp_push_next_buffer): New.
	* cppinit.c (do_includes): Remove.
	(push_include, free_chain, _cpp_push_next_buffer): New.
	(cpp_start_read): Use them to rework command line option handling.
	(cpp_handle_option): Combine handling of -include and -imacros.
	* cpplex.c (_cpp_lex_token): Push a new -include buffer if
	appropriate.  Always insert missing \n at EOF.
	* cpplib.c (start_directive): Get the directive position right.
	* cppmain.c (cb_file_change): Always print the first line, unless
	preprocessed.

From-SVN: r45070
2001-08-21 06:20:18 +00:00
Neil Booth
bb74c96301 cpperror.c (print_location): Don't take a file name; use the line map instead.
* cpperror.c (print_location):  Don't take a file name; use the
	line map instead.
	(_cpp_begin_message): Similarly.
	(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
	cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update.
	(cpp_pedwarn_with_file_and_line): Remove.
	* cppfiles.c (stack_include_file): Update; set filename to stdin
	here when appropriate.
	* cpphash.h (struct cpp_buffer): Remove nominal_fname.
	(_cpp_begin_message): Don't take a file name.
	* cppinit.c: Add comment.
	* cpplex.c: Fix end-of-directive indicator.
	* cpplib.c: Don't include intl.h.
	(run_directive, do_diagnostic): Update.
	(do_line): Update to not use nominal_fname.
	(cpp_push_buffer): Don't take a filename.
	* cpplib.h (struct ht): Remove.
	(cpp_push_buffer): Don't take a filename.
	(cpp_pedwarn_with_file_and_line): Remove.
	* cppmacro.c (struct cpp_macro): Remove file.
	(builtin_macro): Update.
	(_cpp_create_definition): Update.
	* cppmain.c: Correct comment.
	* fix-header.c (read_scan_file): Update.

From-SVN: r44986
2001-08-17 22:23:49 +00:00
Neil Booth
47d89cf3e6 c-lex.c (map): Make const.
* c-lex.c (map): Make const.
	(cb_file_change): Update for callback passing a line map.
	Don't assume we have a previous map.  Remove sanity check
	about popping too many files.
	* cpperror.c (print_location): Make map const.
	* cppfiles.c (stack_include_file): Update; line maps now hold sysp.
	(cpp_make_system_header): Similarly.
	(search_from): Similarly.
	(_cpp_execute_include): Don't remember where we came from.
	* cpphash.h (struct cpp_buffer): Remove return_to_line, sysp.
	(struct cpp_reader): Make map const.
	(CPP_IN_SYSTEM_HEADER, _cpp_do_file_change): Update.
	* cpplib.c (do_line): Update; line maps now hold sysp.
	(cpp_push_buffer): Similarly.
	(_cpp_do_file_change): Similarly; callback with map instead.
	(cpp_get_line_maps): Constify return value.
	(_cpp_pop_buffer): Update.
	* cpplib.h (struct cpp_file_change): Remove.
	(struct cpp_callbacks): Update.
	(cpp_get_line_maps): Constify return value.
	* cppmacro.c (_cpp_create_definition): Update.
	* cppmain.c (struct printer): Constify map.
	(maybe_print_line): Similarly.
	(print_line): Similarly.  Deduce flags 1 and 2 here.
	(cb_file_change): Update.
	* line-map.c (free_line_maps): Warn regardless.
	(add_line_map): Return pointer to const.  When passed NULL to_file
	with LC_LEAVE, use the obvious values for the return point so the
	caller doesn't have to figure them out.
	(lookup_line): Return pointer to const.
	(print_containing_files): Take pointer to const.
	* line-map.h (struct line_map): New members reason, sysp.
	(add_line_map): Return pointer to const.
	(lookup_line): Similarly.
	(print_containing_files): Take pointer to const.

From-SVN: r44789
2001-08-11 07:33:39 +00:00
Neil Booth
42dcba3463 cpplib.h, line-map.h: Update comments.
* cpplib.h, line-map.h: Update comments.
	* cppmain.c (printer_init): Move inline.
	(maybe_print_line, print_line): Take a map pointer.
	(cb_ident, cb_define, cb_undef, cb_include, cb_def_pragma): Update.
	(cb_file_change): Don't use prior value of print.map.

From-SVN: r44697
2001-08-07 17:55:01 +00:00
Neil Booth
fde84349be cpperror.c (print_containing_files): Moved to line-map.c.
* cpperror.c (print_containing_files): Moved to line-map.c.
	(print_location): line-map.c handles re-listing or otherwise.
	* cpphash.h (struct lexer_state): Remove next_bol.
	(struct cpp_buffer): Remove include_stack_listed.
	* cpplib.c (do_line, cpp_push_buffer, _cpp_pop_buffer):
	Remove faked buffer handling.
	(_cpp_do_file_change): Tweak.
	* cpplib.h (enum cpp_buffer_type): Remove BUF_FAKE.
	* cppmain.c (struct printer): Remove filename.
	(print_line, cb_file_change): Update accordingly.
	* line-map.c: Include intl.h.
	(init_line_maps): Initialize last_listed.
	(free_line_maps): Sanity check, warn if ENABLED_CHECKING.
	(add_line_map): Sanity check inputs, warn if ENABLED_CHECKING.
	(print_containing_files): New.
	* line-map.h (struct line_maps): New member last_listed.
	(print_containing_files, INCLUDED_FROM): New.
	* Makefile.in: Update.
	* po/POTFILES.in: Add line-map.c.

From-SVN: r44670
2001-08-06 21:07:41 +00:00
Neil Booth
67821e3a9e re PR preprocessor/3081 (Preprocessor merges 2 first lines when -imacros is being used)
PR preprocessor/3081
	* c-lex.c (map): New.
	(cb_file_change): Update map and use it.
	(cb_def_pragma, cb_define, cb_undef): Use map and line.
	(c_lex): Update to use map.
	* cpperror.c (print_location): Move to using logical line numbers.
	* cppfiles.c (stack_include_file): Update for new _cpp_do_file_change.
	(cpp_make_system_header): Similarly.
	(_cpp_execute_include): Stop line numbering hacks.  Store the
	line we will return to.
	* cpphash.h (CPP_BUF_LINE): Remove.
	(struct cpp_buffer): Remove lineno and pseudo_newlines.
	Add map and return_to_line.
	(_cpp_do_file_change): Update.
	* cppinit.c (cpp_start_read): Update line kludge.
	* cpplex.c (handle_newline): Don't update lineno and pseudo_newlines.
	(trigraph_ok): Use logical line numbers for diagnostics.
	(skip_block_comment): Likewise.
	(skip_whitespace): Likewise.
	(skip_line_comment): Use pfile->line instead.
	(_cpp_lex_token): Update to use logical line numbering exclusively.
	Handle BOL locally.  Accept new lines in directives, but keep
	pfile->line decremented.  Diagnostics use logical lines.  Update
	directive handling.
	* cpplib.c (SEEN_EOL): New.
	(skip_rest_of_line, check_eol): Use it.
	(end_directive): Increase line number when accepting the newline
	at the end of a directive.
	(run_directive): Simplify.
	(do_line): Bad LC_LEAVEs become LC_RENAMEs.  Update.
	(_cpp_do_file_change): Update to take buffer line number as an
	argument, and store the current map in the cpp_reader.  Remove
	line number kludges.
	(_cpp_do__Pragma): Restore output position after a _Pragma.
	(cpp_push_buffer): Don't set output line or lineno.
	(_cpp_pop_buffer): Transfer more info from a faked buffer.
	Remove line kludge.  Set output_line.
	* cppmacro.c (builtin_macro): Update handling of __LINE__.
	(parse_arg): Use logical lines.
	(save_lookahead_token): Save EOFs too now.
	* cppmain.c (struct printer): Fix comments.
	(printer_init): Simplify, let caller do errors.
	(scan_translation_unit, check_multiline_token, dump_macro): Update.
	(maybe_print_line): Simplify.
	(print_line): Don't print a linemarker if -P.
	(cb_define, cb_undef, cb_def_pragma, cb_ident, cb_include): Update.
	(cb_file_change): Simplify.
	* line-map.h (LAST_SOURCE_LINE): Fix.
	(CURRENT_LINE_MAP): New.

	* gcc.dg/cpp/19951025-1.c: Revert.
	* gcc.dg/cpp/directiv.c: We no longer process directives that
	interrupt macro arguments.

From-SVN: r44650
2001-08-05 17:31:25 +00:00
Neil Booth
8bbbef3434 cpphash.h (struct cpp_reader): New member directive_line.
* cpphash.h (struct cpp_reader): New member directive_line.
	* cpplib.h (struct cpp_callbacks): Update prototypes of callbacks.
	* cpplib.c (do_define, do_undef, do_ident, do_include_common,
	do_pragma): Pass line to callbacks.
	(start_directive): Record line of directive.
	* cppmain.c (cb_ident, cb_define, cb_undef, cb_def_pragma,
	cb_include): Similarly.
	* c-lex.c (cb_ident, cb_define, cb_undef, cb_def_pragma):
	Similarly.

From-SVN: r44637
2001-08-04 16:28:14 +00:00
Neil Booth
ef6e958a86 Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h are also on line-map.h.
* Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h
	are also on line-map.h.
	* cppfiles.c (stack_include_file): Update.
	* cpphash.h (struct cpp_buffer): New member return_at_eof.
	(_cpp_pop_buffer): New.
	* cppinit.c (cpp_destroy, cpp_finish): Update.
	(do_includes): Mark each buffer to return at EOF.
	* cpplex.c (_cpp_lex_token): Pop buffers at EOF.  Continue or
	return as requested.
	* cpplib.c (run_directive, do_line, cpp_push_buffer): Update.
	(cpp_pop_buffer): Rename _cpp_pop_buffer.  Stop skipping.
	* cpplib.h (cpp_pop_buffer): Remove.
	(cpp_scan_buffer_nooutput): Rename cpp_scan_nooutput.
	* cppmacro.c (cpp_scan_buffer_nooutput): Similarly.  No need to pop
	buffers.
	* cppmain.c (scan_buffer): Rename scan_translation_unit.  No need
	to pop buffers.
	(do_preprocessing): Update.
	* fix-header.c (read_scan_file): Update.  No need to pop buffers.
	* c-parse.in (_yylex): Similarly.
	* scan-decls.c (scan_decls): Similarly.
	* line-map.h: Update comments.

	* cp/spew.c (read_token): No need to pop buffers.

	* objc/Make-lang.in (objc-act.o): Update dependencies.

From-SVN: r44634
2001-08-04 12:01:59 +00:00
Neil Booth
d82fc1085f line-map.c: New.
* line-map.c: New.
	* line-map.h: New.
	* Makefile.in (line-map.o): New.
	(LIBCPP_OBJS, LIBCPP_DEPS): Update.
	* c-lex.c (cb_file_change): Update for new cpp_file_change structure.
	* cpperror.c (print_containing_files): Similarly.
	(print_location): Update.  Don't output a space before _Pragma.
	* cppfiles.c (stack_include_file): Set to line 1 immediately.
	(stack_include_filee, cpp_make_system_header): Update.
	(_cpp_execute_include): Get logical line number right for calling
	as-yet-unterminated #include.
	* cpphash.h (struct cpp_reader): Add line_maps.
	(_cpp_do_file_change): Update.
	* cppinit.c (cpp_create_reader): Initialize line maps.
	(cpp_destroy): Destroy line maps.
	(cpp_start_read): Get logical line number right.
	* cpplex.c (parse_string): Only warn once for multi-line strings.
	Use boolean variable for null warning.
	* cpplib.c (_cpp_handle_directive): End the directive if it isn't
	already.
	(do_include_common): End the directive early.
	(do_line): Don't warn about out-of-range lines in preprocessed
	source.  Update.  Remove unused variables.
	(_cpp_do_file_change): Update for new line mapping.
	(pragma_cb): New typedef.
	(cpp_register_pragma): Stop looking ahead before calling the
	handler.  Clean up.
	(do_pragma_system_header): End directive early.
	(cpp_get_line_maps): New.
	(cpp_pop_buffer): Fudge logical line.  Update.
	* cpplib.h: Include line-map.h
	(enum cpp_fc_reason): Remove.
	(struct cpp_file_change): Update.
	(cpp_get_line_maps): New.
	* cppmain.c (struct_printer): New member map.
	(cb_file_change): Update for new mappings.
	* fix-header.c (cb_file_change): Similarly.
testsuite:
	* gcc.dg/cpp/19951025-1.c: Update.

From-SVN: r44584
2001-08-02 23:03:31 +00:00
Neil Booth
09b822537f cpphash.h (struct cpp_reader): Remove import_warning.
* cpphash.h (struct cpp_reader): Remove import_warning.
	* cpplib.c (skip_rest_of_line): Don't bother turning off
	macro expansion.
	(parse_include): Move include handling to...
	(do_include_common): ... here.  Move import warning from...
	(do_import): ... here.
	(do_pragma_poison): Don't do a callback for poison identifiers.
	* cpplib.h (struct cpp_callbacks): Don't do poison callbacks.
	* cppmain.c (setup_callbacks): Similarly.

From-SVN: r44466
2001-07-29 22:27:20 +00:00
Neil Booth
7096171b54 cppmacro.c (make_string_token): Avoid warning.
* cppmacro.c (make_string_token): Avoid warning.
	(cpp_macro_definition): Prepend the macro name.  Update
	comments.
	* cppmain.c (cb_define, dump_macro): Update for changes
	to cpp_macro_definition.

From-SVN: r43528
2001-06-23 11:34:41 +00:00
Neil Booth
2a967f3d3a Makefile.in (OBJS, [...]): Update.
* Makefile.in (OBJS, LIBCPP_OBJS, LIBCPP_DEPS,
	cpplib.o, cpphash.o, fix-header): Update.
	(hashtable.o): New target.
	* c-common.h: Include cpplib.h.  Define C_RID_CODE and
	struct c_common_identifier here.
	* c-lang.c (c_init_options): Update.  Call set_identifier_size.
	* c-lex.c (c_lex): Update.
	* c-pragma.h: Update.
	* c-tree.h (struct lang_identifier): Contain c_common_identifier.
	Delete rid_code.
	(C_RID_CODE): Delete.
	* cpphash.c: Rewrite to use hashtable.c.
	* cpphash.h: Update include guards.
	(struct cpp_reader): Remove hashtab.
	hash_ob and buffer_ob are no longer pointers.  Add hash_table
	and our_hashtable.
	(HASHSTEP, _cpp_init_hashtable,	_cpp_lookup_with_hash): Delete.
	(_cpp_cleanup_hashtable): Rename _cpp_destroy_hashtable.
	(_cpp_cleanup_stacks): Rename _cpp_init_directives.
	* cppinit.c (cpp_create_reader): Update.
	* cpplex.c (cpp_ideq, parse_identifier, cpp_output_token): Update.
	(cpp_interpret_charconst): Eliminate warning.
	* cpplib.c (do_pragma, do_endif, push_conditional,
	cpp_push_buffer, cpp_pop_buffer): Update.
	(_cpp_init_stacks): Rename cpp_init_directives.
	(_cpp_cleanup_stacks): Remove.
	* cpplib.h: Update include guards.  Include tree-core.h and c-rid.h.
	(cpp_hashnode, cpp_token, NODE_LEN, NODE_NAME,
	 cpp_forall_identifiers, cpp_create_reader): Update.
	(C_RID_CODE, cpp_make_node): New.
	(c_common_identifier): New identifier node for C front ends.
	* cppmain.c (main): Update.
	* fix-header.c (read_scan_file): Update.
	* flags.h (id_clash_len): Make unsigned.
	* ggc.h (ggc_mark_nonnull_tree): New.
	* hashtable.c: New.
	* hashtable.h: New.
	* stringpool.c: Update comments and copyright.  Update to use
	hashtable.c.
	* toplev.c (approx_sqrt): Move to hashtable.c.
	(id_clash_len): Make unsigned.
	* toplev.h (ident_hash): New.
	* tree.c (gcc_obstack_init): Move to hashtable.c.
	* tree.h: Include hashtable.h.
	(IDENTIFIER_POINTER, IDENTIFIER_LENGTH): Update.
	(GCC_IDENT_TO_HT_IDENT, HT_IDENT_TO_GCC_IDENT): New.
	(struct tree_identifier): Update.
	(make_identifier): New.
cp:
	* cp-tree.h (struct lang_identifier, C_RID_YYCODE): Update.
	(C_RID_CODE): Remove.
	* lex.c (cxx_init_options): Call set_identifier_size.  Update.
	(init_parse): Don't do it here.
objc:
	* objc-act.c (objc_init_options): Call set_identifier_size. Update.

From-SVN: r42334
2001-05-20 06:26:45 +00:00
Neil Booth
a28c50359b cppexp.c (lex): Use NODE_NAME and NODE_LEN.
* cppexp.c (lex): Use NODE_NAME and NODE_LEN.
	* cpphash.c (_cpp_lookup_with_hash): Similarly.
	* cpplex.c (cpp_ideq, parse_identifier, cpp_token_len,
	cpp_spell_token, cpp_output_token): Similarly.
	* cpplib.c (lex_macro_node, do_undef, do_pragma,
	do_pragma_poison, parse_assertion, do_assert): Similarly.
	* cppmacro.c (builtin_macro, parse_args, funlike_invocation_p,
	save_parameter, _cpp_create_definition, check_trad_stringification,
	cpp_macro_definition): Similarly.
	* cppmain.c (cb_define, cb_undef, dump_macro): Similarly.
	* c-lex.c (cb_undef, c_lex): Similarly.
	* fix-header.c (recognized_function): Similarly.
	* cpplib.h (NODE_LEN, NODE_NAME): New.
	(cpp_hashnode): Rename length len.

From-SVN: r42174
2001-05-16 22:02:09 +00:00
Zack Weinberg
6d4587f735 cppinit.c (cpp_post_options): Shut off macro expansion if -fpreprocessed.
* cppinit.c (cpp_post_options): Shut off macro expansion if
	-fpreprocessed.
	* cpplib.c (_cpp_handle_directive): If -fpreprocessed, accept
	IN_I directives only if the # is in column 1 and the directive
	name begins in column 2.
	* cppmain.c (scan_buffer): Insert a space between # and an
	identifier, when that identifier is a directive name.

	* tradcpp.c (struct file_buf): Add a pointer to the next entry
	in the header search path.
	(enum node_type): Add T_INCLUDE_NEXT.
	(directive_table): Add entry for include_next.
	(do_include_next): New function.
	(process_include): New routine, broken out of do_include.
	(finclude): Insert 'nhd' argument, to be copied into
	next_header_dir of the new buffer.
	(main): Adjust to match.
	* gsyslimits.h, limity.h: Un-indent #include_next.

testsuite:
	* gcc.dg/cpp/direct2.c: New test.
	* gcc.dg/cpp/direct2s.c: New test.

	* gcc.c-torture/execute/920730-1t.c: #undef __GNUC__ at head.

From-SVN: r41932
2001-05-10 00:07:23 +00:00
Neil Booth
7868b4a252 cppfiles.c (_cpp_execute_include): Don't make a null-terminated copy of the filename.
* cppfiles.c (_cpp_execute_include): Don't make a null-terminated
	copy of the filename.  Don't use CPP_PREV_BUFFER.  Don't call
	strlen or strcpy; we already know the length.
	(_cpp_compare_file_date): Similarly.
	* cpphash.h (struct cpp_reader): Delete done_initialising.
	(CPP_PREV_BUFFER): Delete.
	* cppinit.c (cpp_start_read): Don't set done_initialising.
	* cpplex.c (parse_string): Guarantee null-termination.
	(_cpp_equiv_toklists): Remove.
	* cpplib.c (glue_header_name): Null-terminate.
	(do_line): Don't leak memory.
	* cpplib.h (BT_WEAK): Delete.
	* cppmain.c (cb_ident): Strings are now null-terminated.

From-SVN: r40233
2001-03-04 12:02:02 +00:00
Neil Booth
373e217703 cppfiles.c: Update comments.
* cppfiles.c: Update comments.
        (_cpp_read_file): Don't check for NULL filenames any more.
        * cppinit.c (cpp_start_read): Don't do canonicalization of
        in_fname and out_fname.  Use the passed file name exclusively.
        (_cpp_handle_options): Don't treat "-" as a command line option,
        but as a normal filename.
        (_cpp_post_options): Canonicalize in_fname and out_fname.
        * cppmain.c (printer_init): Don't check out_fname for NULL.
        * c-lex.c (orig_filename): Rename cpp_filename for clarity.
        (init_c_lex): Update, and use "" to represent stdin to CPP.
        (yyparse): Update.

From-SVN: r39938
2001-02-21 07:29:56 +00:00
Neil Booth
bd9697727b cpphash.h (struct cpp_buffer): Move saved_flags from cpp_reader.
* cpphash.h (struct cpp_buffer): Move saved_flags from cpp_reader.
        * cpplex.c (_cpp_lex_token): New token picks up the saved flags,
        and AVOID_LPASTE is cleared on meeting an unescaped newline.
        * cppmacro.c (builtin_macro): Set builtin flags here.
        (paste_all_tokens): Preserve AVOID_LPASTE on pasted token.
        (replace_args): Clarify intent.
        (cpp_get_token): Macro expansion tokens get the saved flags.
        Update.
        * cppmain.c (scan_buffer): Remove now-redundant print.printed
        check.

From-SVN: r39393
2001-02-01 19:13:53 +00:00
Neil Booth
26ec42ee4d cpphash.c (_cpp_cleanup_hashtable, [...]): Don't set fe_value.
* cpphash.c (_cpp_cleanup_hashtable, _cpp_lookup_with_hash)
        : Don't set fe_value.
        * cpplib.h (AVOID_LPASTE): New flag.
        (struct cpp_hashnode): Remove fe_value.
        * cpplex.c (cpp_avoid_paste): Don't paste '.' with a number.
        * cppmacro.c (builtin_macro): Don't set flags here.
        (replace_args): Set AVOID_LPASTE flag on first token of an
        argument, and the token following it.
        (cpp_get_token): Set AVOID_LPASTE flag on first token of a
        macro expansion, and on the token following it.  Do it for
        builtins too.
        * cppmain.c (scan_buffer): Avoid pasting only flagged tokens.

From-SVN: r39318
2001-01-28 11:22:23 +00:00
Alan Modra
95f4ac8b8a * cppmain.c (general_init): Don't use ANSI prototype.
From-SVN: r39073
2001-01-16 18:40:56 +00:00
Neil Booth
400023a387 c-parse.in (finish_parse): Add comment about cpp_destroy.
* c-parse.in (finish_parse): Add comment about cpp_destroy.
        * cp/lex.c (finish_parse): Similarly.
        * cppinit.c (cpp_cleanup): Rename cpp_destroy for clarity.
        Return the number of errors encountered.
        * cpplib.h (cpp_cleanup): Rename cpp_destroy, return int.
        * cppmain.c (main): Don't call cpp_destroy.

From-SVN: r39020
2001-01-14 22:00:20 +00:00
Neil Booth
6de8f7fc96 cppmain.c (do_preprocessing): New function; most of the old main.
* cppmain.c (do_preprocessing): New function; most of the old
        main.
        (main): Call it to do most of the work.
        (cb): Move from global scope to set_callbacks ().
        (setup_callbacks): Get the callback pointer.
        (general_init, printer_init): Clean up code and comments.

From-SVN: r39012
2001-01-14 16:44:50 +00:00
Neil Booth
d6d52dd655 cppfiles.c (_cpp_fake_include): New function.
* cppfiles.c (_cpp_fake_include): New function.
        * cpphash.h (_cpp_fake_include): New.
        * cpplib.c (do_line): Call _cpp_fake_include when entering
        header files in preprocessed input.
        * cppmain.c (cb_pragma_implementation): Remove handling.
	(setup_callbacks): Don't register pragmas.

From-SVN: r38987
2001-01-13 18:39:26 +00:00
Neil Booth
620ef26c8c cppmain.c (struct printer): Remove no_line_dirs.
* cppmain.c (struct printer): Remove no_line_dirs.
        (options, cb): New.
        (main, setup_callbacks, scan_buffer, printer_init, cb_define)
        : Use options rather than CPP_OPTION.
        (setup_callbacks): Use cb rather than pfile->cb.
        (main): No need to check for a buffer.  Use cpp_errors.
        (printer_init): Don't set no_line_dirs.
        (maybe_print_line): Use options not no_line_dirs.
        (cb_file_change): Don't call print_line if -P.

From-SVN: r38983
2001-01-13 14:24:34 +00:00
Neil Booth
7e96d768fe cppinit.c (cpp_handle_option): help_only is now part of the cpp_options structure.
* cppinit.c (cpp_handle_option): help_only is now part of the
        cpp_options structure.
        * cpplib.c (cpp_errors, cpp_get_options, cpp_get_callbacks,
        cpp_set_callbacks): New functions.
        * cpplib.h (cpp_callbacks): Break out as a named structure.
        (cpp_options): Move help_only here from cpp_reader.
        (CPP_FATAL_ERRORS): Update to use cpp_errors.
        (cpp_errors, cpp_get_options, cpp_get_callbacks,
        cpp_set_callbacks): New prototypes.
        * cppmain.c (main): Update for help_only.

From-SVN: r38971
2001-01-13 01:00:01 +00:00
Neil Booth
05e8172427 [multiple changes]
2001-01-11  Neil Booth  <neil@daikokuya.demon.co.uk>

        * cppinit.c (cpp_start_read): If -fpreprocessed, ignore
	-D, -U and -A, and don't initialize the builtins.
	* cppmain.c (cb_define, cb_undef): Unconditionally process
	the callback.
	* tradcpp.c (main): Fix typo.

2000-01-11  Mark Elbrecht  <snowball3@bigfoot.com>

        * cppfiles.c (cpp_included, find_include_file, _cpp_execute_include)
          (read_name_map): Use IS_ABSOLUTE_PATH.
        * tradcpp.c (get_filename): Likewise.

From-SVN: r38925
2001-01-11 21:30:16 +00:00
Neil Booth
5c5d1ea0c8 cppinit.c (OPT_g): Remove.
* cppinit.c (OPT_g): Remove.
        (cpp_handle_option): Update for removed -g3.
        (print_help): Update.
        * cpplib.h (struct cpp_options): Remove debug_output.
        * cppmain.c (setup_callbacks, cb_define): Update.
        * gcc.c (cpp_options): Translate -g3 to -dD.

From-SVN: r38881
2001-01-10 21:32:15 +00:00