diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2003-04-19 00:22:51 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2003-04-19 00:22:51 +0000 |
commit | 26aea0737b2d0c4ee328d547555ae25ab5de9a0a (patch) | |
tree | 6e2502497aefe03b070107d7b41bbe6be454b727 /gcc/cppmacro.c | |
parent | 606c99912372a1fd5354765992eaef014ab78ce2 (diff) | |
download | gcc-26aea0737b2d0c4ee328d547555ae25ab5de9a0a.zip gcc-26aea0737b2d0c4ee328d547555ae25ab5de9a0a.tar.gz gcc-26aea0737b2d0c4ee328d547555ae25ab5de9a0a.tar.bz2 |
cppfiles.c (ENABLE_VALGRIND_CHECKING, [...]): Remove.
* 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
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r-- | gcc/cppmacro.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index 94fa858..0898dac 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); |