Commit Graph

193 Commits

Author SHA1 Message Date
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
Neil Booth 10cf9bdee6 cpplex.c (parse_identifier_slow): Rename parse_slow, adjust prototype, and handle lexing numbers and identifiers.
* cpplex.c (parse_identifier_slow): Rename parse_slow, adjust
	prototype, and handle lexing numbers and identifiers.
	(parse_identifier): Update to new form of parse_slow.
	(parse_number): Fast path only, use parse_slow otherwise.
	(_cpp_lex_direct): Update calls to parse_number.

From-SVN: r51161
2002-03-22 07:23:21 +00:00
Jim Meyering 001e3fee0d cpplex.c (cpp_parse_escape): Restore mistakenly-removed code: \a still means TARGET_BELL.
* cpplex.c (cpp_parse_escape): Restore mistakenly-removed code:
	\a still means TARGET_BELL.

From-SVN: r50154
2002-02-28 18:46:17 +00:00
Zack Weinberg f458d1d5d7 c-common.c, [...]: Delete code implementing -traditional mode.
* c-common.c, c-common.h, c-decl.c, c-lex.c, c-parse.in,
	c-tree.h, c-typeck.c, cppexp.c, cpplex.c, cpplib.c, cpplib.h,
	cppmacro.c, objc/lang-specs.h, objc/objc-act.c,
	builtin-types.def, builtins.def, dwarf2out.c, dwarfout.c,
	gcc.c, toplev.c: Delete code implementing -traditional mode.

	* ada/misc.c, ch/ch-tree.h, ch/decl.c, cp/decl2.c, f/com.c,
	f/lex.c, f/top.c, java/builtins.c, java/decl.c: Delete
	traditional-mode-related code copied from the C front end
	but not used, or used only to permit the compiler to link.

	* doc/bugreport.texi, doc/cpp.texi, doc/extend.texi,
	doc/invoke.texi, doc/standards.texi, doc/trouble.texi:
	Document removal of -traditional mode for compilation, and
	remove documentation only relevant to that mode.

	* config/nextstep.h, config/ptx4.h, config/svr4.h,
	config/convex/convex.h, config/d30v/d30v.h,
	config/i386/dgux.h, config/i386/osf1elf.h,
	config/i386/osfelf.h, config/i386/osfrose.h,
	config/i386/sco5.h, config/i386/sol2.h, config/m68k/a-ux.h,
	config/m68k/hp310.h, config/m88k/dgux.h,
	config/m88k/dguxbcs.h, config/m88k/luna.h, config/m88k/m88k.c,
	config/m88k/m88k.h, config/m88k/openbsd.h,
	config/mips/abi64.h, config/mips/osfrose.h,
	config/mips/svr4-5.h, config/mips/svr4-t.h,
	config/sparc/sol2-sld-64.h, config/sparc/sol2.h,
	config/stormy16/stormy16.h: Remove all references to
	-traditional from target specs.  Delete all mention of the
	no-longer-necessary TRADITIONAL_RETURN_FLOAT macro.  Also
	delete a couple of commented-out definitions of
	DOLLARS_IN_IDENTIFIERS, with (incorrect) commentary referring
	to -traditional.

	* system.h: Poison TRADITIONAL_RETURN_FLOAT.
	* doc/tm.texi: Remove mention of TRADITIONAL_RETURN_FLOAT macro.

	* testsuite/gcc.c-torture/execute/920730-1t.c,
	testsuite/gcc.c-torture/execute/920730-1t.x,
	testsuite/gcc.dg/ext-glob.c: Delete test cases, only relevant
	to -traditional.

From-SVN: r50110
2002-02-27 18:48:07 +00:00
Neil Booth e808ec9c71 cpplex.c (_cpp_lex_token): Handle directives in macro arguments.
* cpplex.c (_cpp_lex_token): Handle directives in macro
	arguments.
	* cpplib.c (_cpp_handle_directive): Save and restore state
	if parsing macro args when entering a directive.
	* cppmacro.c (collect_args): No need to handle directives
	in macro arguments.
	(enter_macro_context, replace_args): Use the original macro
	definition in case it was redefined whilst collecting arguments.
doc:
	* cpp.texi: Update.
testsuite:
	* gcc.dg/cpp/undef1.c: Remove.
	* gcc.dg/cpp/directiv.c: Update.
	* gcc.dg/cpp/mac-dir-1.c, mac-dir-2.c: New tests.

From-SVN: r50091
2002-02-27 07:24:53 +00:00
Neil Booth a47ed31052 cpplex.c (cpp_interpret_charconst): Get signedness or otherwise of wide character constants correct.
* cpplex.c (cpp_interpret_charconst): Get signedness or
	otherwise of wide character constants correct.
	* cppexp.c (lex): Get signedness of wide charconsts correct.
	* testsuite/gcc.dg/cpp/wchar-1.c: New test.

From-SVN: r50005
2002-02-24 12:52:30 +00:00
Neil Booth 0fef3fd0ea 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
2002-02-02 18:56:37 +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 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
Neil Booth 0abc6a6a4f cpphash.c (_cpp_init_hashtable): Update.
* cpphash.c (_cpp_init_hashtable): Update.
	* cpphash.h (struct spec_nodes): Remove n_L.
	* cpplex.c (_cpp_lex_direct): Check for prefix L separately.

	* Makefile.in: Update, and add c-objc-common.o dependencies.
	* c-lang.c: Remove unnecessary includes.
	(c_init): Move bulk of code to c_objc_common_init, and call it.
	(c_tree_printer, c_missing_noreturn_ok_p, c_disregard_inline_limits,
	inline_forbidden_p, c_cannot_inline_tree_fn): Move to
	c-objc-common.c.
	* c-objc-common.c: New.  Mostly pulled from c-lang.c.
	* c-tree.h (c_disregard_inline_limits, c_cannot_inline_fn,
	c_objc_common_init, c_missing_noreturn_ok_p): New.
	* toplev.c: Update comment.
	* doc/passes.texi: Update.
	* objc/ojbc-act.c (LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN,
	LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS,
	LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P): Override.
	(objc_init): Update to use c_objc_common_init.

From-SVN: r47388
2001-11-27 22:31:34 +00:00
Neil Booth 4d6baafa31 cppfiles.c (stack_include_file): Don't optimize zero-length files.
* cppfiles.c (stack_include_file): Don't optimize zero-length
	files.
	(read_include_file): NUL-terminate read files.
	* cpplex.c (handle_newline, skip_escaped_newlines,
	get_effective_char, skip_whitespace, parse_identifier,
	parse_identifier_slow, parse_number, parse_string,
	_cpp_lex_direct): Optimize for the fact that buffers are guaranteed
	NUL-terminated.
	* cpplib.c (destringize_and_run, cpp_define, handle_assertion):
	Be sure buffers are NUL terminated.
	* cppmacro.c (warn_of_redefinition): Kill compile warning.

	* c-common.c: Include tree-inline.h.
	(c_language): Move separate definitions here.
	(c_common_init_options, c_common_post_options): New.
	(c_common_lang_init): Rename c_common_init.
	* c-common.h (c_common_lang_init): Similarly.
	(c_common_init_options, c_common_post_options): New.
	* c-lang.c (c_post_options): Move body to c_common_post_options.
	(c_init_options): Use c_common_init_options.
	(c_init): Update.
	* langhooks.def: Rearrange.
	* langhooks.h: Rearrange, and improve comments.
	* toplev.c (do_compile): New function.
	(toplev_main): Use it.
	(lang_independent_f_options, parse_options_and_default_flags,
	process_options): Remove trailing periods.
	* Makefile.in: Update.
cp:	* decl2.c (c_language): Move to c-common.c.
	* lex.c (cxx_post_options, cxx_init_options): Use c-common.c
	functions.
	(cxx_init): Update.
objc:	* objc-act.c (objc_post_options, objc_init_options): Use c-common.c
	functions.
	(ojbc_init): Update.

From-SVN: r47362
2001-11-26 23:44:54 +00:00
Andreas Jaeger e1e7d56bf1 cpplex.c (cpp_interpret_charconst): Use HOST_WIDE_INT for sign extension.
* cpplex.c (cpp_interpret_charconst): Use HOST_WIDE_INT for sign
	extension.

	* gcc.dg/cpp/charconst-2.c: New test.

From-SVN: r47286
2001-11-23 11:01:16 +01: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
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
Kaveh R. Ghazi 0df6c2c74e c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold extra calls into fewer ones.
* c-format.c (maybe_read_dollar_number): Use safe-ctype macros
	and/or fold extra calls into fewer ones.
	* collect2.c (dump_file): Likewise.
	* cppexp.c (parse_number): Likewise.
	* cpplex.c (_cpp_lex_direct): Likewise.
	* final.c (output_asm_insn, asm_fprintf): Likewise.
	* fix-header.c (inf_scan_ident, main): Likewise.
	* fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
	Likewise.
	* fold-const.c (real_hex_to_f): Likewise.
	* gen-protos.c (parse_fn_proto): Likewise.
	* genattrtab.c (check_attr_test, check_attr_value): Likewise.
	* genrecog.c (change_state, write_action): Likewise.
	* gensupport.c (shift_output_template): Likewise.
	* local-alloc.c (requires_inout): Likewise.
	* mips-tfile.c (IS_ASM_IDENT): Likewise.
	* protoize.c (is_id_char, main): Likewise.
	* real.c (asctoeg): Likewise.
	* recog.c (asm_operand_ok): Likewise.
	* reload.c (find_reloads): Likewise.
	* scan.c (scan_identget_token): Likewise.
	* sched-vis.c (print_value): Likewise.
	* stringpool.c (ggc_alloc_string): Likewise.
	* toplev.c (read_integral_parameter, decode_g_option): Likewise.
	* tradcif.y (parse_number, yylex, parse_escape): Likewise.
	* tradcpp.c (rescan): Likewise.
	* tree.c (clean_symbol_name): Likewise.
	* varasm.c (decode_reg_name): Likewise.

	* alpha.h (ASM_OUTPUT_ASCII): Likewise.
	* darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise.
	* dsp16xx.h (ASM_OUTPUT_ASCII): Likewise.
	* m88k.c (output_ascii): Likewise.
	* m88k.h (OVERRIDE_OPTIONS): Likewise.
	* mcore.h (REG_CLASS_FROM_LETTER): Likewise.
	* ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise.
	* sh.h (REG_CLASS_FROM_LETTER): Likewise.

cp:
	* xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
	extra calls into fewer ones.

f:
	* bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra
	calls into fewer ones.
	* implic.c (ffeimplic_lookup_): Likewise.
	* intdoc.c (dumpimp): Likewise.
	* intrin.c (ffeintrin_init_0): Likewise.
	* lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_):
	Likewise.
	* lex.h (ffelex_is_firstnamechar): Likewise.
	* target.c (ffetarget_integerhex): Likewise.

java:
	* gjavah.c (jni_print_char, decode_signature_piece): Use
	safe-ctype macros and/or fold extra calls into fewer ones.
	* lex.c (java_read_unicode, java_lex): Likewise.
	* lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT,
	JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise.
	* mangle_name.c (append_unicode_mangled_name,
	unicode_mangling_length): Likewise.

From-SVN: r46397
2001-10-21 21:32:15 +00:00
Neil Booth 480709cc6c cpphash.h (struct cpp_buffer): Delete read_ahead and extra_char.
* cpphash.h (struct cpp_buffer): Delete read_ahead and extra_char.
	* cpplex.c (lex_percent, lex_dot): Remove.
	(get_effective_char, skip_block_comment, skip_line_comment,
	parse_identifier_slow, parse_number, parse_string, save_comment,
	_cpp_lex_direct): Update to do lookback freely.
	(IF_NEXT_IS, BACKUP): New macros.
	* cpplib.c (cpp_push_buffer): Don't set read_ahead and extra_char.
	* cppmacro.c (paste_tokens): Update.

From-SVN: r46392
2001-10-21 14:04:42 +00:00
Neil Booth 870628131c cpplex.c (handle_newline, [...]): Update to do more stepping back.
* cpplex.c (handle_newline, skip_escaped_newlines,
	get_effective_char, skip_block_comment, skip_line_comment,
	parse_identifier_slow, parse_number, parse_string,
	_cpp_lex_direct): Update to do more stepping back.
	(trigraph_ok): Similarly.  Rename trigraph_p.
	(SAVE_STATE, RESTORE_STATE): Remove.
	(BUFF_SIZE_UPPER_BOUND): Tweak.  Add sanity check.

	* cpplib.c (destringize): Rename destringize_and_run, and
	call run_directive directly.
	(_cpp_do__Pragma): Simplify.

From-SVN: r46373
2001-10-20 09:00:53 +00:00
Richard Earnshaw 34f5271ddd cpplex.c (_cpp_get_buff): Fix off-by-one error that caused memory leak.
* cpplex.c (_cpp_get_buff): Fix off-by-one error that caused memory
leak.

From-SVN: r46317
2001-10-17 16:20:04 +00:00
Zack Weinberg 8206c799f2 * cpplex.c (digraph_spellings, token_spellings): Make static.
From-SVN: r46201
2001-10-11 21:21:57 +00:00
Kazu Hirata 4fe9b91c45 c-common.c: Fix comment typos.
* c-common.c: Fix comment typos.
	* cfgrtl.c: Likewise.
	* collect2.c: Likewise.
	* cpplex.c: Likewise.
	* doloop.c: Likewise.
	* dwarf2out.c: Likewise.
	* dwarfout.c: Likewise.
	* expr.c: Likewise.
	* fold-const.c: Likewise.
	* gcc.c: Likewise.
	* gcov.c: Likewise.
	* gcse.c: Likewise.
	* global.c: Likewise.
	* ifcvt.c: Likewise.
	* loop.c: Likewise.
	* optabs.c: Likewise.
	* protoize.c: Likewise.
	* regclass.c: Likewise.
	* reorg.c: Likewise.
	* rtl.h: Likewise.
	* stmt.c: Likewise.
	* tree.h: Likewise.
	* doc/cpp.texi: Likewise.
	* doc/c-tree.texi: Likewise.
	* doc/extend.texi: Likewise.
	* doc/invoke.texi: Likewise.
	* doc/objc.texi: Likewise.
	* doc/tm.texi: Likewise.

From-SVN: r46114
2001-10-09 06:03:16 +00:00
Zack Weinberg 47ad413896 cpplex.c (enum spell_type): Add SPELL_NUMBER.
* cpplex.c (enum spell_type): Add SPELL_NUMBER.
	(cpp_token_len, cpp_spell_token, cpp_output_token,
	_cpp_equiv_tokens): Handle it.
	* cpplib.h (TTYPE_TABLE): Use SPELL_NUMBER for CPP_NUMBER and
	CPP_COMMENT, SPELL_NONE for CPP_PADDING and CPP_EOF.
	* cppexp.c (_cpp_parse_expr): Use the correct operator code in
	error messages.

From-SVN: r46052
2001-10-06 23:11:27 +00:00
Neil Booth 8c3b269309 cpphash.h (POOL_ALIGN, [...]): Remove.
* cpphash.h (POOL_ALIGN, POOL_FRONT, POOL_LIMIT, POOL_BASE,
	POOL_SIZE, POOL_ROOM, POOL_COMMIT, struct cpp_chunk,
	struct cpp_pool, _cpp_init_pool, _cpp_free_pool, _cpp_pool_reserve,
	_cpp_pool_alloc, _cpp_next_chunk): Remove.
	(_cpp_extend_buff, BUFF_ROOM): Update.
	(_cpp_append_extend_buff): New.
	(struct cpp_reader): Remove macro_pool, add a_buff.
	* cppinit.c (cpp_create_reader): Initialize a_buff, instead of
	macro_pool.
	(cpp_destroy): Free a_buff instead of macro_pool.
	* cpplex.c (new_chunk, chunk_suitable, _cpp_next_chunk,
	new_chunk, _cpp_init_pool, _cpp_free_pool, _cpp_pool_reserve,
	_cpp_pool_alloc, ): Remove.
	(parse_number, parse_string): Update use of _cpp_extend_buff.
	(_cpp_extend_buff): Update.
	(_cpp_append_extend_buff, cpp_aligned_alloc): New.
	* cpplib.c (glue_header_name, parse_answer):
	Update use of _cpp_extend_buff.
	(cpp_register_pragma, cpp_register_pragma_space): Use
	_cpp_aligned_alloc.
	(do_assert, do_unassert): Check for EOL, update.
	* cppmacro.c (stringify_arg, collect_args): Update to use
	_cpp_extend_buff and _cpp_append_extend_buff.
	(save_parameter, parse_params, alloc_expansion_token,
	_cpp_create_definition): Rework memory management.

	* gcc.dg/cpp/redef2.c: Add test.

From-SVN: r45899
2001-09-30 10:03:11 +00:00
Neil Booth 6142088c6c cpplex.c (new_buff, [...]): Use size_t everywhere, make definitions consistent with prototypes.
* cpplex.c (new_buff, _cpp_get_buff, _cpp_extend_buff):
	Use size_t everywhere, make definitions consistent with
	prototypes.

From-SVN: r45860
2001-09-28 13:25:38 +00:00
Neil Booth ece54d544d cpphash.h (struct cpp_buff): Make unsigned.
* cpphash.h (struct cpp_buff): Make unsigned.
	(_cpp_get_buff): Take length of size_t.
	(_cpp_unaligned_alloc): New.
	(BUFF_ROOM, BUFF_FRONT, BUFF_LIMIT): New.
	(struct cpp_reader): Remove ident_pool.  Add u_buff.
	* cppinit.c (cpp_create_reader): Initialize u_buff, not ident_pool.
	(cpp_destroy): Destroy u_buff, not ident_pool.
	* cpplex.c (parse_number, parse_string, save_comment,
	cpp_token_as_text): Update to use the unaligned buffer.
	(new_buff): Make unsigned.
	(_cpp_unaligned_alloc): New.
	* cpplib.c (glue_header_name): Update to use the unaligned buffer.
	* cppmacro.c (new_number_token, builtin_macro, stringify_arg):
	Similarly.
	(collect_args): Make unsigned.

From-SVN: r45858
2001-09-28 09:40:22 +00:00
Zack Weinberg 3b681e9dcc cpplex.c (cpp_output_token): Use a putc loop for SPELL_OPERATOR, and fwrite for SPELL_IDENT.
* cpplex.c (cpp_output_token): Use a putc loop for
	SPELL_OPERATOR, and fwrite for SPELL_IDENT.

	* configure.in: Detect fwrite_unlocked and fprintf_unlocked.
	* configure, config.in: Regenerate.
	* system.h: Replace fwrite and fprintf with their unlocked
	variants if available.

From-SVN: r45855
2001-09-28 07:00:27 +00:00
Neil Booth c9e7a60950 cpphash.h: Update comment.
* cpphash.h: Update comment.
	* cpplex.c: Update comments.
	(_cpp_can_paste): Remove.
	* cpplib.h (_cpp_can_paste): Remove.
	* cppmacro.c (paste_tokens, paste_all_tokens): Update to use the
	lexer rather than _cpp_can_paste.

From-SVN: r45840
2001-09-27 12:59:38 +00:00
Neil Booth 1e013d2ee5 cpphash.h (struct cpp_pool): Remove locks and locked.
* cpphash.h (struct cpp_pool): Remove locks and locked.
	(struct cpp_context): Add member buff.
	(struct cpp_reader): Remove member argument_pool.
	(_cpp_lock_pool, _cpp_unlock_pool): Remove.
	* cppinit.c (cpp_create_reader, cpp_destroy): Argument_pool is dead.
	* cpplex.c (chunk_suitable): Remove pool argument.
	(MIN_BUFF_SIZE, BUFF_SIZE_UPPER_BOUND, EXTENDED_BUFF_SIZE): New.
	(new_buff, _cpp_extend_buff): Update.
	(_cpp_get_buff): Fix silly pointer bug.  Be more selective about
	which buffer is returned.
	(_cpp_next_chunk, _cpp_init_pool): Pool locking removed.
	(_cpp_lock_pool, _cpp_unlock_pool): Remove.
	* cppmacro.c (lock_pools, unlock_pools): Remove.
	(push_ptoken_context): Take a _cpp_buff.
	(enter_macro_context): Pool locking removed.
	(replace_args): Use a _cpp_buff for the replacement list with
	arguments replaced.
	(push_token_context): Clear buff.
	(expand_arg): Use _cpp_pop_context.
	(_cpp_pop_context): Free a context's buffer, if any.

From-SVN: r45833
2001-09-26 21:44:35 +00:00
Neil Booth b8af0ca5c7 cpphash.h (struct _cpp_buff, [...]): New.
* cpphash.h (struct _cpp_buff, _cpp_get_buff, _cpp_release_buff,
	_cpp_extend_buff, _cpp_free_buff): New.
	(struct cpp_reader): New member free_buffs.
	* cppinit.c (cpp_destroy): Free buffers.
	* cpplex.c (new_buff, _cpp_release_buff, _cpp_get_buff,
	_cpp_extend_buff, _cpp_free_buff): New.
	* cpplib.h (struct cpp_options): Remove unused member.
	* cppmacro.c (collect_args): New.  Combines the old parse_arg
	and parse_args.  Use _cpp_buff for memory allocation.
	(funlike_invocation_p, replace_args): Update.

From-SVN: r45827
2001-09-26 17:52:50 +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 14baae01f6 cpphash.h (_cpp_lex_direct): New.
* cpphash.h (_cpp_lex_direct): New.
	* cpplex.c (_cpp_lex_token): Update.
	(lex_token): Rename _cpp_lex_direct; lex into pfile->cur_token,
	and increment that pointer.
	* cppmacro.c (alloc_expansion_token): New.
	(lex_expansion_token): Lex macro expansion directly into
	macro storage.

From-SVN: r45656
2001-09-17 18:26:12 +00:00
Neil Booth 345894b43f cpphash.h (_cpp_lex_token): Update prototype.
* cpphash.h (_cpp_lex_token): Update prototype.
	* cpplex.c (_cpp_lex_token): New prototype.
	* cpplib.c (skip_rest_of_line, check_eol, _cpp_handle_directive,
	lex_macro_node, read_flag, do_pragma_poison): Update.
	* cppmacro.c (cpp_get_token, parse_params,
	lex_expansion_token): Update.

From-SVN: r45646
2001-09-16 13:44:29 +00:00
Neil Booth 5041042620 cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos.
* cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos.
	Split mlstring_pos into mls_line and mls_col.
	* cppinit.c (cpp_create_reader): Initialize line to 1.
	(cpp_destroy): Free tokenruns.
	(push_include): Don't update lexer_pos.
	* cpplex.c (unterminated, parse_string): Update.
	(lex_token): Don't update lexer_pos, update.
	* cpplib.c (if_stack): Save line instead of line + col.
	(start_directive, _cpp_do__Pragma, do_else, do_elif,
	push_conditional, _cpp_pop_buffer): Update.
	* cppmacro.c (funlike_invocation_p): Don't save lexer_pos.
	(_cpp_create_definition): Update.

From-SVN: r45627
2001-09-15 10:18:03 +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 bdcbe49686 c-parse.in (_yylex): Use _cpp_backup_tokens.
* c-parse.in (_yylex): Use _cpp_backup_tokens.
	* cpphash.h (struct tokenrun): Add prev.
	(struct lexer_state): Remove bol.
	(struct cpp_reader): Remove old lookahead stuff, add lookaheads.
	(_cpp_free_lookaheads, _cpp_release_lookahead, _cpp_push_token)
	: Remove.
	* cppinit.c (cpp_create_reader): Don't set bol.
	(cpp_destroy): Don't free lookaheads.
	* cpplex.c (lex_directive): Remove.
	(next_tokenrun): Update.
	(_cpp_lex_token): Clean up logic.
	(lex_token): Update to return a pointer to lexed token, since it
	can move to the start of the buffer.  Simpify newline handling.
	* cpplib.c (SEEN_EOL): Update.
	(skip_rest_of_line): Remove lookahead stuff.
	(end_directive): Line numbers are already incremented.  Revert
	to start of lexed token buffer if we can.
	(_cpp_handle_directive, do_pragma, do_pragma_dependency,
	parse_answer): Use _cpp_backup_tokens.
	(run_directive, cpp_pop_buffer): Don't set bol, set saved_flags
	instead.  Don't check for EOL.
	(do_include_common, do_line, do_pragma_system_header): Use
	skip_rest_of_line.
	* cpplib.h (BOL, _cpp_backup_tokens): New.
	* cppmacro.c (save_lookahead_token, take_lookahead_token,
	alloc_lookahead, free_lookahead, _cpp_free_lookaheads,
	cpp_start_lookahead, cpp_stop_lookahead, _cpp_push_token): Remove.
	(builtin_macro): Don't use cpp_get_line.
	(cpp_get_line): Short term kludge.
	(parse_arg): Handle directives in arguments here.  Back up when
	appropriate.  Store EOF at end of argument list.
	(funlike_invocation_p): Use _cpp_backup_tokens.
	(push_arg_context): Account for EOF at end of list.
	(cpp_get_token): Remove lookahead stuff.  Update.

	* gcc.dg/cpp/directiv.c: Update.
	* gcc.dg/cpp/undef1.c: Update.

From-SVN: r45582
2001-09-13 20:05:17 +00:00
Neil Booth 5fddcffc8a cpphash.h (struct tokenrun): New.
* cpphash.h (struct tokenrun): New.
	(struct cpp_context): New member bol.
	(struct cpp_reader): New members.
	(_cpp_init_tokenrun): New.
	* cppinit.c (cpp_create_reader): Set up the token runs.
	* cpplex.c (lex_directive, lex_token, next_tokenrun): New.
	(lex_token): New internalised version of _cpp_lex_token.  Don't
	handle directives or the multiple include opimisation here any
	more.  Simply lex a token.
	* cpplib.c (run_directive): Clear bol.
	(_cpp_pop_buffer): Set bol.
	* cppmacro.c (funlike_invocation_p): Keep tokens whilst parsing
	arguments.

From-SVN: r45534
2001-09-11 07:00:12 +00:00
Zack Weinberg 2c3fcba6dc cpplex.c (parse_identifier): Fast-path optimize.
* cpplex.c (parse_identifier): Fast-path optimize.  Avoid
	copying identifier when we're just going to throw it away.
	(parse_identifier_slow): New routine to handle abnormal cases.
	(_cpp_lex_token): Update call site.

	* hashtable.c (ht_lookup): Don't assume that the string we've
	been given is NUL-terminated.
	* system.h: #define __builtin_expect(a, b) to (a) if not
	GCC >=3.0.

From-SVN: r45529
2001-09-10 22:34:03 +00:00
Neil Booth 29401c300b cpperror.c (print_location): Don't show _Pragma.
* cpperror.c (print_location): Don't show _Pragma.
	* cppfiles.c (_cpp_pop_file_buffer): Handle -include file pushing
	and file change callback generation here.
	(stack_include_file): Update use of cpp_push_buffer.
	* cpphash.h (_cpp_pop_file_buffer): Update prototype.
	(struct cpp_buffer): Remove type, pfile members.
	* cppinit.c (cpp_handle_option): Use free_chain.
	* cpplex.c (_cpp_lex_token): Don't do -include file pushing here.
	(skip_escaped_newlines, get_effective_char, lex_percent): Take
	a cpp_reader rather than a cpp_buffer.
	(skip_escaped_newlines, get_effective_char, skip_block_comment,
	skip_line_comment, parse_string, lex_percent, lex_dot,
	_cpp_lex_token): Update accordingly.
	* cpplib.c (_cpp_pop_buffer): Don't do file change callback
	generation here.
	(cpp_push_buffer): Update prototype.
	(run_directive): Update use of cpp_push_buffer.
	(_cpp_do__Pragma, cpp_define, cpp_define_builtin, cpp_undef,
	handle_assertion): Update use of run_directive.
	* cpplib.h (enum cpp_buffer_type): Remove.
	(cpp_push_buffer): Update prototype.
	* fix-header.c (read_scan_file): Update.

From-SVN: r45112
2001-08-22 20:37:20 +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 bef985f3f6 cpphash.c (_cpp_destroy_hashtable): Use ht_destroy.
* cpphash.c (_cpp_destroy_hashtable): Use ht_destroy.
	* cpphash.h (CPP_IN_SYSTEM_HEADER): Fix.
	(struct cpp_pool): New member first.
	* cppinit.c (append_include_chain): Plug memory leaks.
	* cpplib.c (cpp_register_pragma, cpp_register_pragma_space):
	Allocate pragma structures from the (aligned) macro pool to
	avoid leaking memory.
	* cpplex.c (_cpp_init_pool, _cpp_free_pool): Use pool->first
	so we don't leak memory.
	* hashtable.c (ht_destroy): New.
	* hashtable.h (ht_destroy): New.

From-SVN: r44794
2001-08-11 12:37:19 +00:00
Neil Booth 7364fdd8e0 cppinit.c (cpp_finish): Pop the final buffer without comment.
* cppinit.c (cpp_finish): Pop the final buffer without comment.
	* cpplex.c (_cpp_lex_token): Don't pop the final buffer; and
	take care to avoid multiple no-newline at EOF warnings in that
	case.

From-SVN: r44701
2001-08-07 20:37:26 +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 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
Kazu Hirata ec5c56db8b alias.c: Fix comment formatting.
* alias.c: Fix comment formatting.
	* bitmap.c: Likewise.
	* builtins.c: Likewise.
	* calls.c: Likewise.
	* c-common.c: Likewise.
	* c-decl.c: Likewise.
	* c-dump.c: Likewise.
	* c-lex.c: Likewise.
	* collect2.c: Likewise.
	* combine.c: Likewise.
	* conflict.c: Likewise.
	* cppfiles.c: Likewise.
	* cppinit.c: Likewise.
	* cpplex.c: Likewise.
	* cpplib.c: Likewise.
	* cppmacro.c: Likewise.
	* cppspec.c: Likewise.
	* c-pragma.c: Likewise.
	* crtstuff.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* c-semantics.c: Likewise.
	* c-typeck.c: Likewise.

From-SVN: r44547
2001-08-01 17:57:27 +00:00
Neil Booth 1444f2ed7c cpphash.h (struct cpp_reader): New members line, pseudo_newlines.
* cpphash.h (struct cpp_reader): New members line, pseudo_newlines.
	* cpplex.c (handle_newline): Update prototype.  Maintain logical
	line number.
	(skip_escaped_newlines, skip_block_comment, parse_string):
	Update accordingly.
	(_cpp_lex_token): Update, and store token position within the token.
	* cpplib.h (struct cpp_token): Add line and column entries.
	* cppmacro.c (replace_args): Position stringified tokens correctly.

From-SVN: r44533
2001-08-01 06:19:39 +00:00
Neil Booth 6d18adbc2c cppexp.c (parse_defined): Always record the macro name.
* cppexp.c (parse_defined): Always record the macro name.
	(lex): Don't worry about identifiers, or special-case
	CPP_NOT here.
	(_cpp_parse_expr): Figure out at the end of the routine
	whether we saw a valid !defined() expression.
	* cppfiles.c (stack_include_file): Update for mi_valid.
	(_cpp_pop_file_buffer): Similarly.
	* cpplex.c (_cpp_lex_token): Similarly.
	* cpphash.h (enum mi_state, enum mi_ind, mi_state,
	mi_if_not_defined, mi_lexed): Remove.
	(mi_valid): New.
	* cpplib.c (do_if): Simplify.
	(do_endif, push_conditional, _cpp_handle_directive): Update
	for renaming of mi_state to mi_valid.

	* cpp.texi: Add index entries for digraphs, and add comment
	that C++ refers to them as alternative tokens.

From-SVN: r44459
2001-07-29 17:27:57 +00:00
Neil Booth cef0d199d2 cpphash.h (struct_lexer_state): Delete was_skipping.
* cpphash.h (struct_lexer_state): Delete was_skipping.
	Move skipping here from struct cpp_reader.
	* cpplex.c (parse_identifier): Update.
	(_cpp_lex_token): Don't skip tokens in a directive.
	* cpplib.c (struct if_stack): Update.
	(start_directive, end_directive): Don't change skipping state.
	(_cpp_handle_directive): Update.
	(do_ifdef, do_ifndef, do_if, do_elif): Similarly.
	(do_else, do_endif): Update; only check for excess tokens if not
	in a skipped conditional block.
	(push_conditional): Update for new struct if_stack.

	* gcc.dg/cpp/extratokens.c: Fix.
	* gcc.dg/cpp/skipping2.c: New tests.

From-SVN: r44380
2001-07-26 06:02:47 +00:00
Neil Booth 932c1783cb cpplex.c (_cpp_lex_token): Revert patch of 16 May 2001 so that we do accept comments in preprocessed input.
* cpplex.c (_cpp_lex_token): Revert patch of 16 May 2001
	so that we do accept comments in preprocessed input.

From-SVN: r42721
2001-05-30 21:22:00 +00:00
Neil Booth f8710242d3 cpp.texi: Update for handling of charconsts.
* cpp.texi: Update for handling of charconsts.
	* cpplex.c (maybe_read_ucs): Don't accept D800-DFFF.  Update
	diagnostics.  Skip to the end if the UCS is too short.
	(cpp_interpret_charconst): Long charconsts issue a warning
	not an error.

	* gcc.dg/cpp/charconst.c: New tests.
	* gcc.dg/cpp/escape.c: New tests.
	* gcc.dg/cpp/escape-1.c: New tests.
	* gcc.dg/cpp/escape-2.c: New tests.
	* gcc.dg/cpp/ucs.c: New tests.

From-SVN: r42514
2001-05-23 22:50:28 +00:00