Commit Graph

18 Commits

Author SHA1 Message Date
Kazu Hirata a110561799 c-decl.c, [...]: Fix comment typos and formatting.
* c-decl.c, c-ppoutput.c, combine.c, cppfiles.c, dwarf2out.c,
	expr.c, fold-const.c, gcc.c, haifa-sched.c, loop-iv.c,
	params.def, read-rtl.c, rtl.c, rtlanal.c, toplev.c: Fix
	comment typos and formatting.  Follow spelling conventions.

From-SVN: r78555
2004-02-27 07:09:43 +00:00
Per Bothner 22234f56d2 re PR preprocessor/14103 (ICEs on "gcc -E -imacros foo.h baz.c")
* cpphash.h (struct cpp_buffer):  Restore return_at_eof field.  This
	partly reverts my 2003-10-01 change, because we're back to logically
	including <command line> inside the main line.
	* cpplex.c (_cpp_get_fresh_line):  Check return_at_eof field.
	* cppmacro.c (cpp_scan_nooutput):  Set return_at_eof of current buffer.
	Fixes PR preprocessor/14103.

	* cppfiles.c (_cpp_stack_include):  When appropriate decrement
	line_table's highest_location, fixing LAST_SOURCE_LINE_LOCATION.
	(cpp_push_include):  Don't need to increment pfile's line field.
	* line-map.h (LAST_SOURCE_LINE_LOCATION):  Only decrement by 1.

	* c-ppoutput.c (print struct):  New first_time field.
	(init_pp_output):  Set print.first_time.
	(pp_file_change):  Use print.first_time, rather than MAIN_FILE_P,
	which is set also for (say) <command line>.  Clear print.first_time.

	* cppfiles.c (struct _cpp_file):  Comment and type for pch field
	does not match the code, so fix both.
	(should_stack_file):  Inline include_pch_p function.
	(include_pch_p):  Remove pointless function.

	* cpphash.h (struct cpp_buffer):  Remove unused search_cached field.

From-SVN: r78049
2004-02-18 14:02:39 -08:00
Kazu Hirata 9ac9746067 c-decl.c, [...]: Fix comment formatting.
* c-decl.c, c-ppoutput.c, cpphash.h, cpplib.h, dbxout.c,
	line-map.c, line-map.h, var-tracking.c: Fix comment
	formatting.

From-SVN: r77888
2004-02-16 14:20:10 +00:00
Per Bothner 12f9df4ec5 Represent column numbers using line-map's source_location.
The "next available source_location" is now managed internally by
	line-maps.c rather than by clients.
	* line-map.h (struct line_map):  New field column_bits.
	<from_line>:  Rename field to start_location.
	(struct line_maps):  New fields highest_location and max_column_hint.
	(linemap_check_files_exited):  New declaration.
	(linemap_line_start):  New declaration.
	(linemap_add):  Remove from_line parameter; use highest_location field.
	(SOURCE_LINE, LAST_SOURCE_LINE):  Modify to use column_bits.
	(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION):  New macros.
	(CURRENT_LINE_MAP):  Remove macro.
	(linemap_position_for_column):  New inline function.
	* line-map.c (linemap_init):  Clear new fields.
	(linemap_check_files_exited):  New function, extracted from ...
	(linemap_free):  Use linemap_check_files_exited.
	(linemap_add):  Remove from_line parameter.  Various updates.
	(linemap_line_start):  New function.
	(linemap_lookeup):  Update for new field names.
	* cpphash.h (struct cpp_reader) <map>:  Field removed.  Because
	linemap_position_for_column may unpredictably change the current map,
	it is cleaner and simpler for us to not cache it in cpp_reader.
	(struct cpp_buffer):  New sysp field.
	Changed warned_cplusplus_comments and from_stage3 to bitfields.
	* cppinit.c (cpp_read_min_file):  pfile->map no longer exists.
	* cpplib.c (do_line, do_linemarker, _cpp_do_file_change):  Get
	current map using linemap_lookup.
	(do_linemarker):  Also set buffer's sysp field.
	(destringize_and_run):  No longer need to decrement current line.
	* cppfiles.c (_cpp_stack_file):  Set sysp from and in buffer.
	(search_path_head, open_file_failed):  Use buffer's sysp.
	(cpp_make_system_header):  Get current map using linemap_lookup.
	Also set buffer's sysp flag.
	* cppmacro.c (_cpp_builtin_macro_text):  Likewise use linemap_lookup.
	* cpphash.h (CPP_INCREMENT_LINE):  New macro.
	(struct cpp_buffer):  Moved fields saved_cur, saved_rlimit to ...
	(struct cpp_reader):  ... and adding saved_line_base field.
	* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
	Update accordingly.  Don't adjust line.
	(_cpp_scan_out_logical_line):  Use CPP_INCREMENT_LINE.
	* cpphash.c (CPP_IN_SYSTEM_HEADER):  Replaced macro by ...
	(cpp_in_system_header):  ... new inline function, using buffer's sysp.
	* cpperror.c (_cpp_begin_message):  Update to use cpp_in_system_header.
	* cpplex.c (_cpp_lex_direct):  Likewise.
	* cppmacro.c (_cpp_builtin_macro_text):  Likewise.
	* cppmacro.c (_cpp_create_definition):  Use buffer's sysp field.
	* cpplib.h (struct cpp_token):  Rename line field to src_loc.
	Remove col field as it is now subsumed by src_loc.
	* cpperror.c:  Update various field, parameter, and macro names.
	(print_location):  If col==0, try SOURCE_COLUMN of line.
	(cpp_error):  Use cur_token's src_loc field, rather than line+col.
	* cpplib.c (do_diagnostic):  Token's src_loc fields replaces line+col.
	* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
	_cpp_skip_block_comment):  Use CPP_INCREMENT_LINE.
	(_cpp_temp_token):  Replace cpp_token's line+col fields by src_loc.
	(_cpp_get_fresh_line):  Don't need to adjust line for missing newline.
	(_cpp_lex_direct):  Use linemap_position_for_column.
	* c-ppoutput.c (maybe_print_line, print_line):  Don't take map
	parameter.  Instead get it from the line_table global.  Adjust callers.
	(print):  Remove map field.  Replace line field to src_line.
	(init_pp_output, account_for_newlines, maybe_print_line):  Adjust.
	(cb_line_change):  Use SOURCE_COLUMN.  Minor optimizations.
	(pp_file_change):  Use MAIN_FILE_P since we cannot checked print.map.
	Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
	* cpptrad.c (copy_comment):  Rename variable.
	* c-lex.c (map):  Remove static variable, for same reason we removed
	cpp_reader's map field.
	(cb_line_change, cb_def_pragma, cb_define, cb_undef):  Hence we need
	to call linemap_lookup.
	(cb_line_change):  Token's line field replaced by src_loc.
	(fe_file_change):  Use MAINFILE_P and LAST_SOURCE_LINE macros.
	Don't save new_map.

	* cpphash.h, cpperror.c, cpplib.h:  Some renames of fileline to
	source_location.

From-SVN: r77663
2004-02-11 07:29:30 -08:00
Kazu Hirata 0ea5865c17 c-ppoutput.c, [...]: Update copyright.
gcc/
	* c-ppoutput.c, cfganal.c, diagnostic.h, print-rtl.c,
	config/darwin.c, config/darwin.h, config/ia64/ia64-c.c,
	config/m32r/linux.h, config/rs6000/ppc64-fp.c,
	config/sparc/openbsd.h, doc/makefile.texi, doc/passes.texi:
	Update copyright.

	cp/
	* rtti.c: Update copyright.

From-SVN: r77449
2004-02-07 14:14:54 +00:00
Kazu Hirata fb0840fc1e * c-ppoutput.c, var-tracking.c: Fix comment typos.
From-SVN: r77448
2004-02-07 13:55:07 +00:00
Per Bothner 8e9ea4d72c Partially revert/redo 2003-10-01 change; fix -fworking-directory.
* c-ppoutput.c (pp_dir_change):  New function.
	* c-common.h (pp_dir_change):  New declaration.
	* cpplib.h (struct cpp_options):  Remove working_directory field.
	* cppinit.c (cpp_find_main_file, cpp_push_main_file):  Merge back to
	(cpp_read_main_file):  as before 10-01.  Call _cpp_stack_file.
	Don't handle -fworking_directory here, but in c_common_post_options.
	(read_original_directory): Don't back up when done.
	Don't clear no-longer used working_directory flag.
	* cpplib.h:  Update declarations to match.
	* c-lex.c (cb_dir_change):  Move to c-opts.c.
	(init_c_lex):  Don't set dir_change callback here, since we want
	to set it even if flag_preprocess_only.
	* c-opts.c (cb_dir_change):  Function moved from c-lex.c.
	(c_common_post_options):  Set dir_change callback.
	Call pp_dir_change if approporiate.
	(finish_options):  Don't call cpp_find_main_file here.	Hence remove
	unneeded parameter and result. Do LC_RENAME for <built-in>.
	(c_common_post_options):  Call cpp_read_main_file here instead.
	(c_common_init):  Update accordingly.
	(push_command_line_include):  Don't cpp_push_main_file.
	Do LC_RENAME rather than LC_LEASE to get back to main file.
	Compared to pre-10-01 version, inline cpp_rename_to_main_file.
	(c_common_parse_file):  Call cpp_read_main_file for subsequent main
	files, but call finish_options for all files.
	* c-opts.c (sanitize_cpp_opts):  Don't set cpp_opts->working_directory.
	* fix-header.c (read_scan_file):  Call cpp_read_main_file instead of
	cpp_find_main_file + cpp_push_main_file.
	* c-lex.c (fe_file_change):  Don't set main_input_filename here.
	* opts.c (handle_options):  Only set main_input_filename first time.

From-SVN: r77303
2004-02-04 22:52:26 -08:00
Per Bothner f4b2bde73f c-lex.c (fe_file_change): Handle a NULL new_map.
* c-lex.c (fe_file_change):  Handle a NULL new_map.
	* fix-header.c (cb_file_change):  Likewise.
	* c-ppoutput.c (pp_file_change):  Likewise.

From-SVN: r72011
2003-10-02 00:03:42 -07:00
Mike Stump a1c18b4ac8 c-ppoutput.c (print): Use fileline typedef for field 'line'.
* c-ppoutput.c (print):  Use fileline typedef for field 'line'.
	(print_line, maybe_print_line, cb_define, cb_undef, cb_include,
	cb_ident, cb_def_pragma):  Use fileline typedef.
	* cpphash.h (struct cpp_reader):  Likewise for field out.first_line.

From-SVN: r71554
2003-09-18 17:47:53 -07:00
Alexandre Oliva 7b9a5a662b c-ppoutput.c (cb_line_change): Revert 2003-08-04's change.
* c-ppoutput.c (cb_line_change): Revert 2003-08-04's change.
* c-lex.c (cb_line_change): Skip line changing whenever
c-ppoutput.c would.

From-SVN: r71381
2003-09-14 13:56:18 +00:00
Alexandre Oliva b2734c680c c-ppoutput.c (cb_line_change): Don't skip line changing while parsing macro arguments in the top-level context.
* c-ppoutput.c (cb_line_change): Don't skip line changing while
parsing macro arguments in the top-level context.

From-SVN: r70148
2003-08-04 16:49:38 +00:00
Zack Weinberg 438396422c Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H).
* Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H).
	(hashtable.o, line-map.o, mkdeps.o): Likewise, from dependency
	list.  Move these all together down by cpplib.

	* cpplib.h: Don't refer to MAX_WCHAR_TYPE_SIZE when determining
	definition of CPPCHAR_SIGNED_T.

	* cppcharset.c, cpperror.c, cppexp.c, cppfiles.c, cpphash.c, cppinit.c
	* cpplex.c, cpplib.c, cppmacro.c, cpppch.c, cpptrad.c, hashtable.c
	* line-map.c, mkdeps.c: Don't include coretypes.h or tm.h.

	* cpphash.c (_cpp_init_hashtable): Don't use gcc_obstack_init.
	* cppinit.c (cpp_create_reader): Likewise.

	* cpphash.h (scan_out_logical_line): Rename _cpp_scan_out_logical_line.
	* cpptrad.c: Likewise.  All callers changed.
	* cpplib.c: All callers changed.
	* c-ppoutput.c: Replace 'uchar' with 'unsigned char' throughout.
	* hashtable.h: Define GTY(x) to nothing here too.

From-SVN: r69298
2003-07-13 17:34:18 +00:00
Andreas Jaeger 2f6e4e977d c-lex.c: Convert to ISO C90.
* c-lex.c: Convert to ISO C90.
	* c-objc-common.c: Likewise.
	* c-opts.c: Likewise.
	* c-pch.c: Likewise.
	* c-ppoutput.c: Likewise.
	* c-pragma.h: Likewise.
	* c-pretty-print.c: Likewise.
	* c-pretty-print.h: Likewise.
	* c-semantics.c: Likewise.
	* c-tree.h: Likewise.
	* c-typeck.c: Likewise.

From-SVN: r68327
2003-06-22 15:41:26 +02:00
Neil Booth 74eb4b3e2e c-ppoutput.c (cb_include): Don't take a cpp_token.
* c-ppoutput.c (cb_include): Don't take a cpp_token.
	* cppfiles.c: Don't undef strcmp.
	(find_include_file): Don't take a cpp_token.  Check for empty
	file names.
	(_cpp_execute_include, _cpp_compare_file_date): Don't take a cpp_token.
	(cpp_push_include): Simplify.
	* cpphash.h (_cpp_execute_include, _cpp_compare_file_date): Update.
	* cpplib.c (glue_header_name): Return the file name, not a cpp_token.
	(parse_include): Similary.  Don't check for zero-length filenames.
	(do_include_common, do_pragma_dependency): Update accordingly.
	* cpplib.h (struct cpp_callbacks): Change prototype of include.

From-SVN: r65894
2003-04-21 19:21:59 +00:00
Neil Booth c1bad961ed Makefile.in: Update.
* Makefile.in: Update.
	* c-common.h (cb_register_builtins): Rename c_cpp_builtins.
	* c-lex.c (init_c_lex): Register builtins hook is dead.
	* c-opts.c (COMMAND_LINE_OPTIONS, missing_arg): Handle -A, -D and -U.
	(c_common_decode_option): Don't call cpp_handle_option.
	Handle -A, -D and -U.
	(handle_deferred_opts): Simplify.
	(finish_options): Define builtins and command line macros.
	* c-ppoutput.c (init_pp_output): Register builtins hook is dead.
	* cppinit.c: Don't include intl.h.
	(init_builtins): Rename cpp_init_builtins.  No hook to call.
	(init_library): Don't need to sort options.
	(cpp_create_reader): Don't set pending.
	(cpp_destroy): Don't free pending.
	(struct pending_option, cl_directive_handler, struct cpp_pending,
	APPEND, free_chain, new_pending_directive, parse_option, opt_comp,
	cpp_finish_options, COMMAND_LINE_OPTIONS, DEF_OPT, struct cl_option,
	cl_options, cpp_handle_option): Remove.
	* cpplib.h (struct cpp_pending, register_builtins, cpp_handle_option,
	cpp_finish_options): Remove.
	(cpp_init_builtins): New.
	* fix-header.c (read_scan_file): Update to handle -D.  Fix
	handling of -I.  Replace call to cpp_finish_options.
cp:
	* Make-lang.in: Update.

From-SVN: r64398
2003-03-15 12:18:47 +00:00
Neil Booth 23345bbbcc /home/neil/diffs/include.log
From-SVN: r64373
2003-03-14 21:47:50 +00:00
Neil Booth 9d10c9a9eb Makefile.in (c-ppoutput.o): Update.
* Makefile.in (c-ppoutput.o): Update.
	* c-common.h (init_pp_output): New.
	(preprocess_file): Update.
	* c-lex.c (init_c_lex): Move mbchar initialization to cpplib.
	Register builtins.
	* c-opts.c (c_common_init): Call init_pp_output if preprocessing.
	Make call to cpp_read_main_file common to whether preprocessing
	or not.  Don't register builtins.
	* c-ppoutput.c: Include c-pragma.h.
	(setup_callbacks): Rename init_pp_output.
	(preprocess_file): No longer setup callbacks or call
	cpp_read_main_file.
	* cpphash.h (_cpp_init_mbchar): New.
	* cppinit.c (init_library): Call _cpp_init_mbchar.
	* cpplex.c (_cpp_init_mbchar): New.

From-SVN: r63913
2003-03-06 23:12:30 +00:00
Neil Booth 63973df350 Makefile.in: Update.
* Makefile.in: Update.
	* c-common.c (flag_no_line_commands, flag_no_output,
	flag_dump_macros, flag_dump_includes): New.
	* c-common.h (flag_no_line_commands, flag_no_output,
	flag_dump_macros, flag_dump_includes, preprocess_file): New.
	(init_c_lex): Update prototype.
	* c-lex.c (init_c_lex): Update prototype; move some code to
	c_common_init.
	* c-opts.c (preprocess_file): Subsume into c_common_init.
	(c_common_decode_option): Update flags.
	(c_common_init): Move code from preprocess_file and init_c_lex.
	(sanitize_cpp_opts): Update.
	* c-ppoutput.c: New, cppmain.c almost verbatim.
	* cpphash.h (struct printer): Remove.
	(struct cpp_reader): Remove print.
	* cpplib.h (dump_none, dump_only, dump_names, dump_definitions,
	cpp_preprocess_file): Remove.
	(struct cpp_options): Remove no_output, no_line_commands, dump_macros
	and dump_includes.
	* cppmain.c: Remove.
	* doc/passes.texi: Update.

From-SVN: r63773
2003-03-04 07:00:39 +00:00