From a54e0bf8102a75fd6b85a7cfbb6b9b1a553befcf Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 19 Apr 2003 00:22:51 +0000 Subject: * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65808 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cppmacro.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'gcc/cppmacro.c') diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index 94fa8583a8a..0898dac8cd1 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -265,6 +265,8 @@ builtin_macro (pfile, node) cpp_hashnode *node; { const uchar *buf; + size_t len; + char *nbuf; if (node->value.builtin == BT_PRAGMA) { @@ -278,14 +280,13 @@ builtin_macro (pfile, node) } buf = _cpp_builtin_macro_text (pfile, node); + len = ustrlen (buf); + nbuf = alloca (len + 1); + memcpy (nbuf, buf, len); + nbuf[len]='\n'; - cpp_push_buffer (pfile, buf, ustrlen (buf), /* from_stage3 */ true, 1); - - /* Tweak the column number the lexer will report. */ - pfile->buffer->col_adjust = pfile->cur_token[-1].col - 1; - - /* We don't want a leading # to be interpreted as a directive. */ - pfile->buffer->saved_flags = 0; + cpp_push_buffer (pfile, (uchar *) nbuf, len, /* from_stage3 */ true, 1); + _cpp_clean_line (pfile); /* Set pfile->cur_token as required by _cpp_lex_direct. */ pfile->cur_token = _cpp_temp_token (pfile); @@ -445,15 +446,10 @@ paste_tokens (pfile, plhs, rhs) if (lhs->type == CPP_DIV && rhs->type != CPP_EQ) *end++ = ' '; end = cpp_spell_token (pfile, rhs, end); - *end = '\0'; + *end = '\n'; cpp_push_buffer (pfile, buf, end - buf, /* from_stage3 */ true, 1); - - /* Tweak the column number the lexer will report. */ - pfile->buffer->col_adjust = pfile->cur_token[-1].col - 1; - - /* We don't want a leading # to be interpreted as a directive. */ - pfile->buffer->saved_flags = 0; + _cpp_clean_line (pfile); /* Set pfile->cur_token as required by _cpp_lex_direct. */ pfile->cur_token = _cpp_temp_token (pfile); -- cgit v1.2.3