aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpptrad.c
AgeCommit message (Collapse)AuthorFilesLines
2003-11-01re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)John David Anglin1-3/+3
PR preprocessor/12847 * 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_". From-SVN: r73183
2003-10-02cpplex.c (_cpp_get_fresh_line): Revert my no-longer-needed 08-28 change...Per Bothner1-3/+2
* cpplex.c (_cpp_get_fresh_line): Revert my no-longer-needed 08-28 change, since we're never called with a NULL buffer. (_cpp_lex_direct): Likewise. * cpptrad.c (_cpp_read_logical_line_trad): Likewise. Return false if buffer is NULL at end. * cpplex.c (_cpp_get_fresh_line): Return value now just depends on whether pfile->buffer is NULL after pop, ignoring return_at_eof. From-SVN: r72013
2003-08-28Fix (hopefully temporary) for breakage caused by my 08-21 patch.Per Bothner1-1/+2
* cpplex.c (_cpp_get_fresh_line): Check for null buffer. (_cpp_lex_buffer): Likewise. * cpptrad.c (_cpp_read_logical_line_trad): Likewise. From-SVN: r70898
2003-07-19alias.c [...]: Remove unnecessary casts.Kaveh R. Ghazi1-2/+1
* alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.c 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. From-SVN: r69587
2003-07-13Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H).Zack Weinberg1-6/+4
* 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-06-28cpptrad.c (skip_macro_block_comment): New.Neil Booth1-1/+24
* cpptrad.c (skip_macro_block_comment): New. (copy_comment): Use it if appropriate. From-SVN: r68641
2003-06-17* cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.cZack Weinberg1-80/+35
* 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. From-SVN: r68070
2003-04-22cpptrad.c (_cpp_replacement_text_len): Add check for macro parameter count.Devang Patel1-2/+2
* cpptrad.c (_cpp_replacement_text_len): Add check for macro parameter count. (_cpp_copy_replacement_text): Same. * gcc.dg/cpp/trad/funlike-5.c: New test. From-SVN: r65952
2003-04-19cppfiles.c (ENABLE_VALGRIND_CHECKING, [...]): Remove.Neil Booth1-173/+80
* cppfiles.c (ENABLE_VALGRIND_CHECKING, VALGRIND_DISCARD, 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. From-SVN: r65808
2002-12-16Merge basic-improvements-branch to trunkZack Weinberg1-3/+5
From-SVN: r60174
2002-11-08re PR preprocessor/8497 (traditional preprocessor #if/#endif bug)Neil Booth1-2/+6
PR preprocessor/8497 PR preprocessor/8501 * cpptrad.c (scan_out_logical_line): A '#' from a macro doesn't start a directive. In assembler, #NUM is not a line directive. From-SVN: r58938
2002-07-23cppexp.c (parse_defined): Mark macro used.Neil Booth1-0/+2
* cppexp.c (parse_defined): Mark macro used. * cpphash.h (struct cpp_macro): New member "used". (_cpp_mark_macro_used, _cpp_warn_if_unused_macro): New. (struct cpp_reader): New member. * cppinit.c (cpp_finish_options): Set first_unused_line. (cpp_finish): Warn of unused macros if requested. (OPT_TABLE): New switches. (cpp_handle_option): Handle them. * cpplib.c (do_undef): Warn if macro unused. (do_ifdef, do_ifndef): Mark macro used. * cpplib.h (struct cpp_options): New member. * cppmacro.c (_cpp_warn_if_unused_macro): New. (enter_macro_context): Mark macro used. (_cpp_create_definition): Mark macro unused; warn if unused when redefined. * cpptrad.c (scan_out_logcial_line, push_replacement_text): Mark macros used. * doc/cppopts.texi: Update. testsuite: * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/trad/Wunused.h, gcc.dg/cpp/Wunused.c, gcc.dg/cpp/Wunused.h: New tests. From-SVN: r55692
2002-07-17cppexp.c (cpp_interpret_integer, [...]): Clarify and correct use of "bool" ↵Neil Booth1-1/+1
variables. * cppexp.c (cpp_interpret_integer, append_digit, parse_defined, 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. From-SVN: r55536
2002-07-09cpperror.c (cpp_error): Default to directive_line within directives here.Neil Booth1-6/+7
* cpperror.c (cpp_error): Default to directive_line within directives here. * cppexp.c (cpp_interpret_integer): Only use traditional number semantics in directives. * cpplib.c (prepare_directive_trad): Don't reset pfile->line. (do_include_common): Similarly. * cpptrad.c (scan_out_logical_line): Implement accurate quoting of <> in #include. * doc/cpp.texi: Update. From-SVN: r55347
2002-07-02cpptrad.c: Update comment.Neil Booth1-1/+2
* cpptrad.c: Update comment. testsuite: * gcc.dg/cpp/trad/directive.c: Add test. * gcc.dg/cpp/trad/macroargs.c: Add test. * gcc.dg/cpp/trad/recurse-3.c: Add tests. From-SVN: r55196
2002-07-01cpptrad.c (skip_whitespace): Pass pointer to prior char.Neil Booth1-1/+1
* cpptrad.c (skip_whitespace): Pass pointer to prior char. testsuite: * gcc.dg/cpp/trad/escaped-nl.c: New test. From-SVN: r55135
2002-06-28re PR preprocessor/7138 (gcc-3.2 failed to compile kernel)Neil Booth1-2/+3
PR preprocessor/7138 * cpplib.c (_cpp_handle_directive): Do traditional preparation after setting state.angled_headers. * cpptrad.c (scan_out_logical_line): Fix potential quote bug. From-SVN: r55055
2002-06-27cpphash.h (_cpp_set_trad_context): Remove.Neil Booth1-46/+32
* cpphash.h (_cpp_set_trad_context): Remove. * cpplib.c (prepare_directive_trad): Do nothing for #define. (cpp_push_buffer, _cpp_pop_buffer): Don't call _cpp_set_trad_context. * cpptrad.c: Update comments. (_cpp_read_logical_line_trad): Let scan_logical_line handle updating the current context. (scan_logical_line): Update the current context. (_cpp_create_trad_definition): Similarly. (_cpp_set_trad_context): Remove. From-SVN: r55022
2002-06-25cpplib.c (do_include_common): Revert to correct line number if -traditional.Neil Booth1-2/+10
* cpplib.c (do_include_common): Revert to correct line number if -traditional. * cpptrad.c (scan_out_logical_line): Treat null directive as white space. Invlidate MI optimization for non-whitespace text outside a directive. testsuite: * gcc.dg/cpp/mi7.c, gcc.dg/cpp/mi7a.h, gcc.dg/cpp/mi7b.h, gcc.dg/cpp/trad/builtins.c, gcc.dg/cpp/trad/builtins.h, gcc.dg/cpp/trad/cmdlne-C.c, gcc.dg/cpp/trad/cmdlne-C2.c, gcc.dg/cpp/trad/maccom1.c, gcc.dg/cpp/trad/maccom2.c, gcc.dg/cpp/trad/maccom3.c, gcc.dg/cpp/trad/maccom4.c, gcc.dg/cpp/trad/maccom6.c, gcc.dg/cpp/trad/mi1.c, gcc.dg/cpp/trad/mi1c.h, gcc.dg/cpp/trad/mi1nd.h, gcc.dg/cpp/trad/mi1ndp.h, gcc.dg/cpp/trad/mi1x.h, gcc.dg/cpp/trad/mi2.c, gcc.dg/cpp/trad/mi2a.h, gcc.dg/cpp/trad/mi2b.h, gcc.dg/cpp/trad/mi2c.h gcc.dg/cpp/trad/mi3.c, gcc.dg/cpp/trad/mi3.def, gcc.dg/cpp/trad/mi3.h, gcc.dg/cpp/trad/mi4.c, gcc.dg/cpp/trad/mi5.c, gcc.dg/cpp/trad/mi6.c, gcc.dg/cpp/trad/mi6a.h, gcc.dg/cpp/trad/mi6b.h, gcc.dg/cpp/trad/mi6c.h, gcc.dg/cpp/trad/mi6d.h, gcc.dg/cpp/trad/mi6e.h, gcc.dg/cpp/trad/mi7.c, gcc.dg/cpp/trad/mi7a.h, gcc.dg/cpp/trad/mi7b.h: New tests. From-SVN: r54978
2002-06-24cpptrad.c (scan_out_logical_line): Check recursing only when we know we have ↵Neil Booth1-13/+45
a macro invocation in the... * cpptrad.c (scan_out_logical_line): Check recursing only when we know we have a macro invocation in the function-like case. Only call _cpp_handle_directive if we know we have a good directive, or we want to reject a bad directive. testsuite: * gcc.dg/cpp/trad/argcout.c, gcc.dg/cpp/trad/assembler.S, gcc.dg/cpp/trad/argcout.c, gcc.dg/cpp/trad/funlike-4.c, gcc.dg/cpp/trad/null-drctv.c, gcc.dg/cpp/trad/recurse-1.c, gcc.dg/cpp/trad/recurse-2.c, gcc.dg/cpp/trad/recurse-3.c: New tests. * gcc.dg/cpp/trad/directive.c: Update. From-SVN: r54942
2002-06-22cpptrad.c (struct fun_macro): Add line number.Neil Booth1-3/+7
* cpptrad.c (struct fun_macro): Add line number. (scan_out_logical_line): Set it, and use it to report unterminated macro invocations. testsuite: * gcc.dg/cpp/trad/comment-2.c. gcc.dg/cpp/trad/funlike-2.c, gcc.dg/cpp/trad/funlike.c, gcc.dg/cpp/trad/funlike-3.c, gcc.dg/cpp/trad/literals-1.c, gcc.dg/cpp/trad/literals-2.c, gcc.dg/cpp/trad/macroargs.c, gcc.dg/cpp/trad/quote.c: New tests. From-SVN: r54907
2002-06-21cpperror.c (cpp_error): For traditional CPP, default to diagnostics on ↵Neil Booth1-2/+2
pfile->line. * cpperror.c (cpp_error): For traditional CPP, default to diagnostics on pfile->line. * cpplib.c (prepare_directive_trad): Set line number for diagnostics for #define too. * cpptrad.c (skip_whitespace): Skip comments properly. (_cpp_expansions_different_trad): Initialize quote2. testsuite: * gcc.dg/cpp/trad: New directory with traditional tests copied from parent directory. * gcc.dg/cpp/assert_trad1.c, gcc.dg/cpp/assert_trad2.c, gcc.dg/cpp/assert_trad3.c, gcc.dg/cpp/defined_trad.c, gcc.dg/cpp/hash2.c, gcc.dg/cpp/tr-define.c, gcc.dg/cpp/tr-direct.c, gcc.dg/cpp/tr-sign.c, gcc.dg/cpp/tr-str.c, gcc.dg/cpp/uchar-2.c: Move to trad/ and rename. * gcc.dg/cpp/trad/__STDC__.c, gcc.dg/cpp/trad/comment.c, gcc.dg/cpp/trad/escaped-eof.c, gcc.dg/cpp/trad/redef1.c, gcc.dg/cpp/trad/redef2.c: New tests. * gcc.dg/cpp/trad/trad.exp: New driver. From-SVN: r54870
2002-06-20cppexp.c (cpp_interpret_integer): Don't force traditional numbers to be ↵Neil Booth1-2/+3
unsigned. * cppexp.c (cpp_interpret_integer): Don't force traditional numbers to be unsigned. * cpplib.c (prepare_directive_trad): Set line number for diagnostics. * cpptrad.c (scan_out_logical_line): Continue scanning out at start of buffer. * gcc.c (trad_capable_cpp): Use cc1 always. f: * lang-specs.h: Use cc1 for traditional preprocessing. testsuite: * gcc.dg/cpp/assert_trad1.c, gcc.dg/cpp/assert_trad2.c, gcc.dg/cpp/assert_trad3.c, gcc.dg/cpp/defined_trad.c, gcc.dg/cpp/hash2.c, gcc.dg/cpp/tr-define.c, gcc.dg/cpp/tr-direct.c, gcc.dg/cpp/tr-sign.c, gcc.dg/cpp/tr-str.c, gcc.dg/cpp/uchar-2.c: Remove. From-SVN: r54856
2002-06-19* cpptrad.c (_cpp_replacement_text_len): initialize len.Andrew Pinski1-0/+1
From-SVN: r54797
2002-06-19cpphash.h (struct cpp_reader): Make date and time strings.Neil Booth1-29/+103
* cpphash.h (struct cpp_reader): Make date and time strings. (_cpp_builtin_macro_text, _cpp_copy_replacement_text, _cpp_replacement_text_len): New. * cppinit.c (cpp_create_reader): Update. (init_builtins): Register appropriate builtins for -traditional-cpp. * cppmacro.c (new_number_token): Remove. (_cpp_builtin_macro_text): New. (builtin_macro): Use it. (cpp_macro_definition): Update to handle traditional macros. * cppmain.c (cb_line_change): Don't do column positioning for traditional output. * cpptrad.c (enum ls): Rename ls_fun_macro to ls_fun_open. New state ls_fun_close. (skip_whitespace): Fix. (maybe_start_funlike): Don't set state.parsing_args. (scan_out_logical_line): Remove duplicate error. Use lex_state rather than state.parsing_args. (push_replacement_text): Handle builtins. (_cpp_replacement_text_len, _cpp_copy_replacement_text): New. From-SVN: r54771
2002-06-18cpplib.c (dtable): Update.Neil Booth1-37/+110
* cpplib.c (dtable): Update. (end_directive): Decrement expansion prevention count. Clear state.in_expression. (prepare_directive_trad): Set state.in_expression. Increment expansion prevention count. * cpptrad.c (enum ls): New. (_cpp_overlay_buffer): Set overlaid_buffer. (_cpp_remove_overlay): Use overlaid_buffer. (_cpp_read_logcial_line_trad): Update buffer when it might have changed. (scan_out_logical_line): Handle state transitions for assertions and defined() in #if, and for funlike invocations including the directive case. Handle '<' and '>' as a quote mechanism in #include. Warn about unterminated macro invocations. * cpphash.h (struct lexer_state): New member in_expression. (struct cpp_reader): New member overlaid buffer. From-SVN: r54732
2002-06-14cpphash.h (struct cpp_buffer): Remove saved_line_base.Neil Booth1-66/+96
* cpphash.h (struct cpp_buffer): Remove saved_line_base. * cpptrad.c: Update comments. (skip_whitespace, copy_comment): Take a new parameter. (skip_escaped_newlines): Don't duplicate escaped newline test. (copy_comment): Different location for CUR, decide here how to copy / replace the comment. (skip_whitespace): Copy whitespace. (_cpp_overlay_buffer, _cpp_remove_overlay): Don't play with line_base. (scan_out_logical_line): Let copy comment handle keeping or replacing comments. (scan_parameters, _cpp_create_trad_definition): Update. From-SVN: r54605
2002-06-13cpphash.h (_cpp_lex_identifier_trad): Remove.Neil Booth1-47/+69
* cpphash.h (_cpp_lex_identifier_trad): Remove. * cpplib.c (end_directive): Don't skip, always remove overlay apart from #define. (prepare_directive_trad): Handle NULL pfile->directive. (_cpp_handle_directive): Always call prepare_directive_trad if traditional. * cppmain.c (check_multiline_token): Rename account_for_newlines, generalize inputs. (scan_translation_unit_trad): Use it. * cpptrad.c (skip_comment): Rename copy_comment, copy comment to output, get escaped newline in comment close correct. (check_output_buffer, skip_whitespace): Update. (_cpp_lex_identifier_trad): Remove. (scan_out_logical_line): Handle -C and comments in directives properly. From-SVN: r54599
2002-06-13cpplib.c (end_directive): Handle line skipping.Neil Booth1-24/+70
* cpplib.c (end_directive): Handle line skipping. Only remove 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. From-SVN: r54573
2002-06-11Makefile.in: Update cppmain.o.Neil Booth1-58/+63
* Makefile.in: Update cppmain.o. * cpphash.h (struct cpp_reader): Move some members to a nested structure. (trad_line): Rename saved_line. (_cpp_read_logical_line_trad): Update. (_cpp_remove_overlay): New. * cppinit.c (cpp_create_reader): No need to set saved_line. (cpp_destroy): Update. (cpp_read_main_file): Only overlay if compiling. * cpplex.c (continue_after_nul): Return false if in directive. * cpplib.c (EXPAND): New. (directive_table, SEEN_EOL): Update. (end_directive): Remove overlay if traditional; don't skip line in traditional #define. (prepare_directive_trad): New. (_cpp_handle_directive, run_directive): Update for traditional directives. (lex_macro_node): Simplify, don't use lex_identifier_trad. * cpplib.h (struct options): Add preprocess_only. * cppmain.c: Don't include intl.h. (cpp_preprocess_file): Set options->preprocess_only. (scan_translation_unit_trad): Fix, and print line numbers. * cpptrad.c (check_output_buffer, lex_identifier, scan_parameters, maybe_start_funlike, scan_out_logical_line, replace_args_and_push, save_replacement_text, _cpp_create_trad_definition): Update for variable renaming. (_cpp_overlay_buffer): Save line number. (_cpp_remove_overlay): Rename from restore_buff, restore line. (_cpp_read_logical_line_trad): Don't handle overlays here. (scan_out_logical_line): Process directives. From-SVN: r54485
2002-06-10cpphash.h (_cpp_read_logical_line_trad, [...]): Update prototypes.Neil Booth1-10/+17
* cpphash.h (_cpp_read_logical_line_trad, _cpp_expansions_different_trad): Update prototypes. * cpplex.c (continue_after_nul): New. * cppmain.c: Include cpphash.h. (scan_translation_unit_trad): New. (cpp_preprocess_file): Call it. * cpptrad.c (_cpp_read_logical_line_trad): Take new parameter overlay. (_cpp_expansions_different_trad): Update prototype. From-SVN: r54446
2002-06-10cpphash.h (struct cpp_macro): Put comments on their own lines.Neil Booth1-14/+100
* cpphash.h (struct cpp_macro): Put comments on their own lines. (_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. From-SVN: r54432
2002-06-09cpphash.h (_cpp_push_text_context): Update.Neil Booth1-53/+243
* cpphash.h (_cpp_push_text_context): Update. (_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 '('. From-SVN: r54412
2002-06-07cpptrad.c (struct block, [...]): New.Neil Booth1-33/+206
* cpptrad.c (struct block, BLOCK_HEADER_LEN, BLOCK_LEN, 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. From-SVN: r54331
2002-06-05cpphash.h (_cpp_create_definition): Update prototype.Neil Booth1-8/+156
* cpphash.h (_cpp_create_definition): Update prototype. (_cpp_push_text_context, _cpp_create_trad_definition): New. ( cpp_lex_identifier_trad): New. (_cpp_set_trad_context): New. * cppinit.c (cpp_finish_options): Don't conditionalize builtins. * cpplib.c (SEEN_EOL): Update. (lex_macro_node): Update for -traditional. (cpp_push_buffer, _cpp_pop_buffer): Similarly. * cppmacro.c (_cpp_create_definition): Split into create_iso_definition() and _cpp_create_trad_definition(). (warn_of_redefinition): Update prototype; handle traditional macros. (_cpp_push_text_context): New. * cpptrad.c (skip_whitespace, push_replacement_text): New. (lex_identifier): Call ht_lookup with correct start. (_cpp_lex_identifier_tradm _cpp_create_trad_definition, _cpp_set_trad_context): New. (scan_out_logical_line): Update to handle changing contexts. From-SVN: r54293
2002-06-04cpphash.h (FIRST, [...]): New.Neil Booth1-16/+20
* cpphash.h (FIRST, LAST, CUR, RLIMIT): New. (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. From-SVN: r54242
2002-05-18cppinit.c (cpp_post_options): If preprocessed, turn off traditional.Neil Booth1-19/+21
* cppinit.c (cpp_post_options): If preprocessed, turn off traditional. If traditional, turn off column numbers. * cpplib.c (cpp_push_buffer): Lex from stage 3 if traditional. * cpptrad.c (handle_newline): Update line_base. (skip_comment): Handle -Wcomment. From-SVN: r53582
2002-05-17Makefile.in: Update for cpptrad.c.Neil Booth1-0/+315
* Makefile.in: Update for cpptrad.c. * cpphash.h (struct cpp_buffer): New members for buffer overlays. (struct cpp_reader): New members for traditional output. (_cpp_read_logical_line, _cpp_overlay_buffer): New. * cppinit.c (cpp_create_reader): Set trad_line. (cpp_destroy): Free trad_out_base if used. (cpp_read_main_file): Overlay an empty buffer if traditional. (cpp_finish_options): Don't do builtins. (COMMAND_LINE_OPTIONS): Add -traditional-cpp. (cpp_handle_option): Handle it. * cpplex.c (continue_after_nul): New. (_cpp_lex_direct): Use handle_nul. * cpplib.h (struct cpp_options): New traditional option. * cpptrad.c: New file. From-SVN: r53568