summaryrefslogtreecommitdiffstats
path: root/gcc/cppmacro.c
Commit message (Collapse)AuthorAgeFilesLines
* * c-opts.c (warn_variadic_macros): New.rth2004-02-191-2/+5
| | | | | | | | | | | | (c_common_handle_option): Set it. (sanitize_cpp_opts): Copy it to cpp_opts. * c.opt (Wvariadic-macros): New. * cpplib.h (struct cpp_options): Add warn_variadic_macros. * cppinit.c (cpp_create_reader): Initialize it. * cppmacro.c (parse_params): Check it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78125 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (struct cpp_buffer): Restore return_at_eof field. Thisbothner2004-02-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78049 138bc75d-0d04-0410-961f-82ee72b054a4
* Represent column numbers using line-map's source_location.bothner2004-02-111-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77663 138bc75d-0d04-0410-961f-82ee72b054a4
* * alias.c, basic-block.h, c-common.c, c-common.h,kazu2004-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | c-cppbuiltin.c, c-opts.c, c-pragma.c, c-pretty-print.c, calls.c, cfg.c, cfgcleanup.c, cfgrtl.c, cgraph.h, collect2.c, combine.c, cppcharset.c, cpphash.h, cppinit.c, cpplib.c, cpplib.h, cppmacro.c, crtstuff.c, cselib.c, cselib.h, defaults.h, df.c, dominance.c, et-forest.c, expmed.c, expr.c, expr.h, fix-header.c, function.h, gcc.c, gcse.c, genattrtab.c, genautomata.c, genconditions.c, genemit.c, genflags.c, gengtype.c, gengtype.h, genopinit.c, genrecog.c, gensupport.c, ggc-zone.c, graph.c, haifa-sched.c, input.h, integrate.c, langhooks-def.h, langhooks.c, langhooks.h, line-map.c, line-map.h, local-alloc.c, optabs.c, optabs.h, postreload.c, ra.h, recog.c, reg-stack.c, regmove.c, reload.c, reorg.c, rtl.c, sched-deps.c, sched-ebb.c, sdbout.c, system.h, target.h, targhooks.c, toplev.h, tree-inline.c, unwind-pe.h, unwind.h, varray.c, varray.h: Update copyright. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76302 138bc75d-0d04-0410-961f-82ee72b054a4
* Move cpp_reader's line_maps field to a shared global.bothner2004-01-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | * cpphash.h (cpp_reader): Rename line_maps field to line_table and change the type to a pointer rather than a struct. * cppinit.c (cpp_push_main_field): Adjust accordingly. * cpplib.c (do_include_common, _cpp_do_file_change, cpp_get_callbacks): Likewise. * cppfiles.c (validate_pch): Likewise. * cppmacro.c (_cpp_warn_if_unused_macro, _cpp_builtin_macro_text): Likewise. * cpperror.c (print_location): Likewise. * cpplib.h (cpp_create_reader): New line_maps pointer parameter. * cppinit.c (cpp_create_reader): Handle new parameter. (cpp_destroy): Don't free line_maps - that's no longer our job. * input.h (line_table): New variable. * toplev.c (line_table): Declare variable. (general_init): Initialize line_table. * c-opts.c (c_common_init_options): Pass line_table to cpp_create_reader. * fix-header.c (read_scan_file): New local variable line_table. Initialize, and pass it to cpp_create_reader. * Makefile.in (LIBS, LIBDEPS): Add libcpp.a. (C_AND_OBJC_OBJS, fix-header): Remove redundant libcpp.a. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76198 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/12847danglin2003-11-011-25/+25
| | | | | | | | | | | * cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c, cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c, c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with "CPP_". git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73183 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (_cpp_pop_buffer): Do generate a _cpp_do_file_changebothner2003-10-021-6/+2
| | | | | | | | | | | | callback even when popping the main file. * cpplib.c (cpp_push_buffer): Since we no longer set return_at_eof, remove the unused return_at_eof parameter. * cppfiles.c, cpplib.c, cppmacro.c, cpppch.c, fix-header.c: Update callers of cpp_push_buffer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72016 138bc75d-0d04-0410-961f-82ee72b054a4
* * hashtable.c (approx_sqrt): Make static.zack2003-07-221-1/+1
| | | | | | | | | | | | | | | | * hashtable.h: Don't prototype approx_sqrt. * line-map.c (init_line_maps): Rename linemap_init. (free_line_maps): Rename linemap_free. (add_line_map): Rename linemap_add. (lookup_line): Rename linemap_lookup. (print_containing_files): Rename linemap_print_containing_files. * linemap.h: Update to match. * cpperror.c, cppinit.c, cpplib.c, cppmacro.c: Update calls to linemap routines to use new names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69672 138bc75d-0d04-0410-961f-82ee72b054a4
* * alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.cghazi2003-07-191-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | c-common.c c-decl.c c-incpath.c c-lex.c c-opts.c c-parse.in c-pragma.c c-typeck.c calls.c cfg.c cfganal.c cfgloop.c cfgrtl.c collect2.c combine.c conflict.c coverage.c cppexp.c cppfiles.c cpphash.c cppinit.c cpplex.c cpplib.c cppmacro.c cppspec.c cpptrad.c cse.c cselib.c dbxout.c defaults.h df.c dominance.c dwarf2out.c dwarfout.c emit-rtl.c except.c expmed.c expr.c final.c fix-header.c flow.c fold-const.c function.c gcc.c gccspec.c gcov.c gcse.c genattr.c genattrtab.c genautomata.c genconditions.c genemit.c genextract.c genoutput.c genrecog.c gensupport.c ggc-page.c ggc-simple.c global.c graph.c haifa-sched.c hashtable.c integrate.c jump.c langhooks.c lcm.c line-map.c local-alloc.c loop.c mips-tdump.c mips-tfile.c mkdeps.c optabs.c params.c postreload.c prefix.c print-tree.c protoize.c ra-build.c ra-colorize.c ra-rewrite.c ra.c recog.c reg-stack.c regclass.c regmove.c regrename.c reload.c reload1.c reorg.c resource.c sbitmap.c sched-deps.c sched-rgn.c sched-vis.c sdbout.c simplify-rtx.c ssa-ccp.c ssa.c stmt.c stor-layout.c timevar.c tlink.c toplev.c tree-dump.c tree.c unroll.c unwind-dw2-fde.c varasm.c varray.c vmsdbgout.c xcoffout.c: Remove unnecessary casts. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69587 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H).zack2003-07-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | (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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69298 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppfiles.c: Clarify comments.neil2003-06-251-2/+2
| | | | | | | | | | * cpphash.h: Likewise. * cpplib.h: Likewise. * cppmacro.c: Likewise. * mkdeps.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68496 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.czack2003-06-171-145/+68
| | | | | | | | | | | * cppfiles.c, cpphash.c, cppinit.c, cpplex.c, cpplib.c * cppmacro.c, cpppch.c, cpptrad.c, cppspec.c: Convert to ISO C: new-style function declarations, no need for PARAMS, no special punctuation on indirect function calls, use string constant concatenation where convenient. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68070 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppmacro.c (warn_of_redefinition): Handle cases where the twodj2003-06-011-4/+6
| | | | | | | | | definitions have different numbers of tokens. * gcc.dg/cpp/redef3.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67307 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplex.c (cpp_token_len): Tighten up.neil2003-04-241-1/+1
| | | | | | | | | (cpp_token_as_text): Need extra byte now. * cpplib.c (glue_header_name): Need extra 2 bytes. * cppmacro.c (cpp_macro_definition): Need extra byte. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66049 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (c-lex.o, LIBCPP_OBJS, cpplex.o): Update.neil2003-04-231-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * c-lex.c (MULTIBYTE_CHARS): Remove conditionals. (lex_string): Take cpp_string with full spelling. (cb_ident): Update. (c_lex): Update diagnostics. * cpplex.c (SPELL_NUMBER, SPELL_STRING): Combine into SPELL_LITERAL. (create_literal): New. (lex_string): Unterminated literals have type CPP_OTHER. (_cpp_lex_direct): Update calls to lex_string. Use create_literal for CPP_OTHER. (cpp_token_len, cpp_spell_token, cpp_output_token): Simplify. (_cpp_equiv_tokens, cpp_interpret_charconst): Update. * cpplib.c (parse_include, do_line, do_linemarker, destringize_and_run): Update for token storing full spelling. * cpplib.h: Update token spelling types. * cppmacro.c (stringify_arg, check_trad_stringification): Update for token storing full spelling. cp: * Make-lang.in (lex.o): Remove mbchar.h. * lex.c (MULTIBYTE_CHARS): Lose. * parser.c (cp_lexer_get_preprocessor_token): CPP_OTHER handled in c-lex.c. testsuite: * gcc.dg/cpp/include2.c: Update. * gcc.dg/cpp/multiline-2.c: New. * gcc.dg/cpp/multiline.c: Update. * gcc.dg/cpp/strify2.c: Update. * gcc.dg/cpp/trad/literals-2.c: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66019 138bc75d-0d04-0410-961f-82ee72b054a4
* * c-lex.c (c_lex): Handle CPP_OTHER differently.neil2003-04-221-1/+1
| | | | | | | | | | | | | | | * cppexp.c (_cpp_parse_expr): Similarly. * cpplex.c (SPELL_CHAR): Remove. (_cpp_lex_direct): Stray chars are saved as byte strings. (cpp_spell_token, cpp_output_token, _cpp_equiv_token): Don't handle SPELL_CHAR. (cpp_avoid_paste): Update handling of CPP_OTHER. * cpplib.h: Spell CPP_OTHER like a number. (struct cpp_token): Remove member c. * cppmacro.c (stringify_arg): Update handling of CPP_OTHER. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65951 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppfiles.c (ENABLE_VALGRIND_CHECKING, VALGRIND_DISCARD,neil2003-04-191-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MMAP_THRESHOLD, TEST_THRESHOLD, SHOULD_MMAP): Remove. (struct include_file): Remove fefcnt, mapped members. (open_file, stack_include_file, _cpp_pop_file_buffer): Disable caching. (read_include_file): Don't use mmap, terminate buffers in '\r'. (purge_cache): Don't use munmap. * cpphash.h (CPP_BUF_COLUMN): Update. (lexer_state): Remove lexing_comment. (struct _cpp_line_note): New. (struct cpp_buffer): New members cur_note, notes_used, notes_cap, next_line and need_line. Remove col_adjust and saved_flags. (_cpp_process_line_notes, _cpp_clean_line, _cpp_get_fresh_line, _cpp_skip_block_comment, scan_out_logical_line): New. (_cpp_init_mbchar): Remove. * cppinit.c (init_library): Remove call to _cpp_init_mbchar. (cpp_read_main_file): Set line to 1 earlier. (post_options): -traditional-cpp doesn't want trigraphs. * cpplex.c (MULTIBYTE_CHARS): Remove code predicated on this. (add_line_note, _cpp_clean_line, _cpp_process_line_notes, _cpp_get_fresh_line): New. (handle_newline, skip_escaped_newlines, trigraph_p, continue_after_nul, _cpp_init_mbchar): Remove. (get_effective_char): Update. (_cpp_skip_block_comment): Rename from skip_block_comment, simplify. (skip_line_comment): Simplify. (skip_whitespace, parse_identifier, parse_slow, parse_number, parse_string): Update. (cpp_lex_direct): Use clean lines and process line notes. Update. (cpp_interpret_charconst): No MULTIBYTE_CHARS. * cpplib.c (prepare_directive_trad): Call scan_out_logical_line directly. (_cpp_handle_directive): Don't set saved_flags. (run_directive, destringize_and_run, cpp_define, cpp_define_builtin, cpp_undef, handle_assertion, cpp_push_buffer): Update. (_cpp_pop_buffer): Free notes. * cppmacro.c (builtin_macro, paste_tokens): \n terminate buffer. * cpppch.c (cpp_read_state): \n terminate buffer. * cpptrad.c (skip_escaped_newlines, handle_newline): Remove. (copy_comment): Use _cpp_skip_block_comment. (skip_whitespace, lex_identifier, _cpp_read_logical_line_trad): Simplify. (_cpp_overlay_buffer, _cpp_remove_overlay, push_replacement_text, save_replacement_text): Update. (scan_out_logical_line): Update to use clean lines and process line notes. * fix-header.c (read_scan_file): Update. testsuite: * gcc.dg/cpp/_Pragma4.c: Remove stray space. * gcc.dg/cpp/trad/escaped-eof.c: Correct line number. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65808 138bc75d-0d04-0410-961f-82ee72b054a4
* /home/neil/diffs/include.logneil2003-03-141-4/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64373 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (struct lexer_state): Add directive_wants_padding.zack2003-02-211-1/+1
| | | | | | | | | | | | | | * cpplib.c (_cpp_handle_directive): Set directive_wants_padding for directives of type INCL. (glue_header_name, parse_include): Use get_token_no_padding. * cppmacro.c (replace_args): If directive_wants_padding, provide padding tokens. * testsuite/gcc.dg/cpp/include3.c: New test. * testsuite/gcc.dg/cpp/inc/foo.h: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63231 138bc75d-0d04-0410-961f-82ee72b054a4
* Merge basic-improvements-branch to trunkzack2002-12-161-5/+23
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60174 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppmacro.c (paste_tokens): Only allow / to paste with =.neil2002-10-091-2/+1
| | | | | | | | testsuite: * gcc.dg/cpp/paste13.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57978 138bc75d-0d04-0410-961f-82ee72b054a4
* 2002-09-27 Alexander N. Kabaev <ak03@gte.com>zack2002-09-281-0/+6
| | | | | | | | | | | PR preprocessor/8055 * cppmacro.c (stringify_arg): Do not overflow the buffer with the terminating NUL when the argument to be stringified has no tokens. * testsuite/gcc.dg/cpp/20020927-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57599 138bc75d-0d04-0410-961f-82ee72b054a4
* * ChangeLog: Follow spelling conventions.kazu2002-09-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ChangeLog.0: Likewise. * ChangeLog.1: Likewise. * ChangeLog.2: Likewise. * ChangeLog.3: Likewise. * ChangeLog.4: Likewise. * ChangeLog.5: Likewise. * ChangeLog.6: Likewise. * FSFChangeLog.10: Likewise. * FSFChangeLog.11: Likewise. * alias.c: Likewise. * basic-block.h: Likewise. * c-aux-info.c: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-semantics.c: Likewise. * c-typeck.c: Likewise. * calls.c: Likewise. * cfganal.c: Likewise. * cfgloop.c: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * conflict.c: Likewise. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.h: Likewise. * cppinit.c: Likewise. * cpplex.c: Likewise. * cpplib.c: Likewise. * cpplib.h: Likewise. * cppmacro.c: Likewise. * cse.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57398 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppmacro.c: Don't warn about function-like macros withoutneil2002-09-201-0/+7
| | | | | | | | | '(' during pre-expandion. testsuite: * gcc.dg/cpp/tr-warn2.c: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57366 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppmacro.c (_cpp_builtin_macro_text): Remove unused variable.neil2002-08-071-1/+0
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56109 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppinit.c (struct lang_flags): Rename trigraphs std.neil2002-08-061-8/+18
| | | | | | | | | | | | | | | (set_lang): Update. * cpplib.h (struct cpp_options): New member std. * cppmacro.c (_cpp_builtin_macro_text): Use std. (collect_args): Flag whether to swallow a possible future comma pasted with varargs. (replace_args): Use this flag. * doc/cpp.texi: Update varargs extension documentation. testsuite: * gcc.dg/cpp/vararg3.c, gcc.dg/cpp/vararg4.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56077 138bc75d-0d04-0410-961f-82ee72b054a4
* * c-common.c (c_common_init): -Wtraditional also implies -Wlong-long.zack2002-08-021-11/+31
| | | | | | | | | | | | | | | | | | * cppinit.c (cpp_post_options): Likewise. * cppexp.c (cpp_classify_number): Suppress -Wtraditional warning about 'LL' suffix (but not 'ULL' etc) when -Wno-long-long is in effect. * cppmacro.c (_cpp_builtin_macro_text) [BT_TIME, BT_DATE]: Check for failing time()/localtime(), issue a warning, and make __TIME__ and __DATE__ expand to fallback strings. * doc/cpp.texi, doc/extend.texi: Document behavior of __DATE__ and __TIME__ when the date and time cannot be determined. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55969 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppmacro.c (_cpp_create_definition): Don't attempt redefinitionneil2002-07-261-2/+4
| | | | | | | warnings on assertions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55778 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppexp.c (parse_defined): Mark macro used.neil2002-07-231-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | * cpphash.h (struct cpp_macro): New member "used". (_cpp_mark_macro_used, _cpp_warn_if_unused_macro): New. (struct cpp_reader): New member. * cppinit.c (cpp_finish_options): Set first_unused_line. (cpp_finish): Warn of unused macros if requested. (OPT_TABLE): New switches. (cpp_handle_option): Handle them. * cpplib.c (do_undef): Warn if macro unused. (do_ifdef, do_ifndef): Mark macro used. * cpplib.h (struct cpp_options): New member. * cppmacro.c (_cpp_warn_if_unused_macro): New. (enter_macro_context): Mark macro used. (_cpp_create_definition): Mark macro unused; warn if unused when redefined. * cpptrad.c (scan_out_logcial_line, push_replacement_text): Mark macros used. * doc/cppopts.texi: Update. testsuite: * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/trad/Wunused.h, gcc.dg/cpp/Wunused.c, gcc.dg/cpp/Wunused.h: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55692 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppexp.c (cpp_interpret_integer, append_digit, parse_defined,neil2002-07-171-12/+13
| | | | | | | | | | eval_token): Clarify and correct use of "bool" variables. * cpplib.h (struct cpp_options): Similarly. * cppmacro.c (parse_params, _cpp_save_parameter): Ditto. * cpptrad.c (recursive_macro): Similarly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55536 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppmacro.c: Forgotten commit.neil2002-07-011-2/+6
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55134 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (struct cpp_reader): Make date and time strings.neil2002-06-191-64/+87
| | | | | | | | | | | | | | | | | | | | | | | | (_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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54771 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (end_directive): Handle line skipping. Only removeneil2002-06-131-0/+1
| | | | | | | | | | | | | | | the rest of the line if the directive was valid. * cppmacro.c (_cpp_push_text_context): Set NODE_DISABLED when expanding a traditional macro. * cpptrad.c (recursive_macro): New. (read_logical_line_trad): Handle skipping. (scan_out_logical_line): Continue after a successful directive. Don't expand macros whilst skipping, or if recursing. (_cpp_create_trad_definition): scan_out_logical_line now sets the output current position. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54573 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (struct cpp_macro): Put comments on their own lines.neil2002-06-101-7/+8
| | | | | | | | | | | | (_cpp_expansions_different_trad): New. * cppmacro.c (warn_of_redefinition): Fix for traditional case. * cpptrad.c (canonicalize_text): New. (scan_out_logical_line): Handle no arguments correctly. (save_replacement_text): Commit memory when finished. (_cpp_expansions_different_trad): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54432 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (_cpp_push_text_context): Update.neil2002-06-091-41/+57
| | | | | | | | | | | | | | | | | | | | (_cpp_arguments_ok): New. * cppmacro.c (_cpp_arguments_ok): New, split out from... (collect_args): ...here. (_cpp_push_text_context): Change inputs. * cpptrad.c (struct fun_macro, maybe_start_funlike, save_argument, replace_args_and_push): New. (lex_identifier, _cpp_lex_identifier_trad, scan_parameters): Don't use IS macros directly. (scan_out_logical_line): Handle function-like macro argument collection. (push_replacement_text): Update. (replacement_length): Remove. (_cpp_create_trad_definition): Don't skip whitespace before checking for '('. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54412 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpptrad.c (struct block, BLOCK_HEADER_LEN, BLOCK_LEN,neil2002-06-071-5/+5
| | | | | | | | | | | | | | | | | | scan_parameters, save_replacement_text, replacement_length): New. (scan_out_logical_line): Take a macro and save parameters if non-NULL. (_cpp_logical_line_trad): Update. (_cpp_create_trad_definition): Update to handle function-like macros. * cpplex.c (new_buff): Update. (struct dummy, DEFAULT_ALIGNMENT, CPP_ALIGN): Move... * cpphash.h: ...here. (CPP_ALIGN2, _cpp_save_parameter): New. * cppmacro.c (save_parameter): Rename, export. (parse_params): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54331 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (_cpp_create_definition): Update prototype.neil2002-06-051-59/+93
| | | | | | | | | | | | | | | | | | | | | | | (_cpp_push_text_context, _cpp_create_trad_definition): New. ( cpp_lex_identifier_trad): New. (_cpp_set_trad_context): New. * cppinit.c (cpp_finish_options): Don't conditionalize builtins. * cpplib.c (SEEN_EOL): Update. (lex_macro_node): Update for -traditional. (cpp_push_buffer, _cpp_pop_buffer): Similarly. * cppmacro.c (_cpp_create_definition): Split into create_iso_definition() and _cpp_create_trad_definition(). (warn_of_redefinition): Update prototype; handle traditional macros. (_cpp_push_text_context): New. * cpptrad.c (skip_whitespace, push_replacement_text): New. (lex_identifier): Call ht_lookup with correct start. (_cpp_lex_identifier_tradm _cpp_create_trad_definition, _cpp_set_trad_context): New. (scan_out_logical_line): Update to handle changing contexts. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54293 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (FIRST, LAST, CUR, RLIMIT): New.neil2002-06-041-11/+11
| | | | | | | | | | | (struct cpp_context): Add traditional fields. * cppmacro.c (paste_all_tokens, push_ptoken_context, push_token_context, cpp_get_token, _cpp_backup_tokens): Update. * cpptrad.c (skip_comment, lex_identifier, _cpp_read_logical_line_trad, scan_out_logical_line): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54242 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/6844neil2002-05-291-1/+1
| | | | | | | | * cppmacro.c (cpp_macro_definition): Reserve space for terminating NUL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54014 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/6780neil2002-05-241-0/+2
| | | | | | | | | * cppmacro.c (enter_macro_context): Clear state.angled_headers. testsuite: * gcc.dg/cpp/paste12.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53851 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpperror.c: Fix formatting.kazu2002-05-221-6/+6
| | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53751 138bc75d-0d04-0410-961f-82ee72b054a4
* * c-common.c (c_common_init): Set options->unsigned_char fromzack2002-05-211-3/+6
| | | | | | | | | | | | | | | | | | | flag_signed_char. (cb_register_builtins): Define __STRICT_ANSI__ and __CHAR_UNSIGNED__ here... * cppinit.c (init_builtins): Not here. (cpp_create_reader): unsigned_char option defaults to 0, not !DEFAULT_SIGNED_CHAR. (COMMAND_LINE_OPTIONS, cpp_handle_option): Lose -fsigned-char and -funsigned-char. * cpphash.h (struct spec_nodes): Kill n__STRICT_ANSI__. * cpphash.c (_cpp_init_hashtable): Don't set it. * cppmacro.c (builtin_macro) [BT_STDC]: Use the language setting directly. Clarify comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53703 138bc75d-0d04-0410-961f-82ee72b054a4
* * c-common.c (STDC_0_IN_SYSTEM_HEADERS, REGISTER_PREFIX):zack2002-05-161-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default-define here. (builtin_define_with_value): Can now wrap the expansion in quotation marks if such is wanted. (cb_register_builtins): Update calls to builtin_define_with_value. Define __REGISTER_PREFIX__, __USER_LABEL_PREFIX__, and __VERSION__ here. (c_common_init): Set options->stdc_0_in_system_headers. * c-lex.h: Update prototype of builtin_define_with_value. * cppdefault.h: Remove default definitions of USER_LABEL_PREFIX and REGISTER_PREFIX. * cppinit.c (VERS, ULP, C, X): Kill. (builtin_array): Remove entries for __VERSION__, __USER_LABEL_PREFIX__, __REGISTER_PREFIX__, and __HAVE_BUILTIN_SETJMP__. Make __STDC__ always a builtin, not a constant. (init_builtins): Kill off a bunch of now-dead code. (COMMAND_LINE_OPTIONS): Remove -fleading-underscore and -fno-leading-underscore. (cpp_handle_option): Remove code to set user_label_prefix. (cpp_post_options): Likewise. * cpplib.h (struct cpp_options): Remove user_label_prefix. (stdc_0_in_system_headers): New. * cppmacro.c (builtin_macro): Check CPP_OPTION (pfile, stdc_0_in_system_headers) too to decide the value of __STDC__. * tradcpp.c (user_label_prefix): Kill. (main): Remove code handling -f(no-)leading-underscore. (initialize_builtins): Don't define __REGISTER_PREFIX__ or __USER_LABEL_PREFIX__. (install_value): Wrap compound statement in dummy loop so the macro works properly in an if statement. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53525 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.h (cpp_macro): Move here, and make expansion a union.neil2002-05-161-27/+15
| | | | | | | | | * cppmacro.c (cpp_macro): Remove. (enter_macro_context, replace_args, warn_of_redefinition, _cpp_create_definition, cpp_macro_definition): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53509 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (cpp_init_internal_pragmas): Remove #pragma poison.neil2002-05-091-2/+2
| | | | | | | | | | | | | * cppmacro.c (paste_all_tokens): Bad pastes are a hard error. doc: * cpp.texi: Update for removal of obsolete features. testsuite: * gcc.dg/cpp/poison.c: Update. * gcc.dg/cpp/20000625-2.c: Remove. * gcc.dg/cpp/direct2s.c: Remove final test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53333 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppfiles.c (_cpp_pop_file_buffer): Return void. Moveneil2002-04-221-2/+6
| | | | | | | | | | | | | | | | | file change and include code to _cpp_pop_buffer. * cpphash.h (struct pending_option): Predeclare. (struct cpp_reader): New member next_include_file. (_cpp_pop_file_buffer): Update. (_cpp_push_next_buffer): Update, rename. * cppinit.c (cpp_destroy): Free include chain and pending here. (cpp_finish_options): Simplify. (_cpp_push_next_buffer): Rename and clean up. * cpplib.c (cpp_pop_buffer): Move code from _cpp_pop_file_buffer. Clarify. * cppmacro.c (cpp_scan_nooutput): Set return_at_eof here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52621 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppexp.c (struct op, parse_number): Replace U_CHAR with uchar.neil2002-04-211-10/+10
| | | | | | | | | | | | | | | | | * cppfiles.c (read_include_file): Similarly. * cpphash.h (DSC, U_CHAR, ustrcmp, ustrncmp, ustrlen, uxstrdup ustrchr, ufputs): Similarly. * cppinit.c (TRIGRAPH_MAP, cpp_destroy): Similarly. * cpplex.c (parse_slow, unescaped_terminator_p, save_comment, cpp_ideq, parse_identifier, parse_number): Similarly. * cpplib.c (struct directive, dequote_string, D, run_directive, cpp_push_buffer): Similarly. * cppmacro.c (new_string_token, builtin_macro, cpp_quote_string, _cpp_create_definition, check_trad_stringification, cpp_macro_definition): Similarly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52587 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppmacro.c (funlike_invocation_p): Don't step back over CPP_EOF.neil2002-04-211-6/+11
| | | | | | | | testsuite: * gcc.dg/cpp/endif.h, gcc.dg/cpp/endif.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52586 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpperror.c (print_location): Don't print include chainneil2002-04-141-28/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52302 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppinit.c (cpp_create_reader): Initializethorpej2002-04-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | discard_comments_in_macro_exp. (COMMAND_LINE_OPTIONS): Add "-CC" option. (cpp_handle_option): Handle "-CC" option. * cpplex.c (save_comment): If saving a C++ comment in a directive, convert it to a C comment. (_cpp_lex_direct): Pass second comment start character to save_comment to indicate comment type. * cpplib.c (_cpp_handle_directive): If processing a "#define" directive and discard_comments_in_macro_exp is false, re-enable saving of comments. (lex_macro_node): If discard_comments_in_macro_exp is false, discard any comments before the macro identifier. * cpplib.h (struct cpp_options): Add discard_comments_in_macro_exp member. * cppmacro.c (cpp_get_token): If expanding a macro while processing a directive, discard any comments we might encounter. (parse_params): If discard_comments_in_macro_exp is false, ignore comments in the macro parameter list. * gcc.c (cpp_unique_options): Add "-CC" option. (option_map): Map "--comments-in-macros" to "-CC". * doc/cppopts.texi: Document "-CC" option. * f/lang-specs.h: Add "-CC" option. * testsuite/gcc.dg/cpp/maccom1.c: New test. * testsuite/gcc.dg/cpp/maccom2.c: New test. * testsuite/gcc.dg/cpp/maccom3.c: New test. * testsuite/gcc.dg/cpp/maccom4.c: New test. * testsuite/gcc.dg/cpp/maccom5.c: New test. * testsuite/gcc.dg/cpp/maccom6.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51975 138bc75d-0d04-0410-961f-82ee72b054a4
OpenPOWER on IntegriCloud