summaryrefslogtreecommitdiff
path: root/gcc/cpphash.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-14 23:29:45 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-14 23:29:45 +0000
commite2f9a79f86f078c40323984d2ee549e1ba2b19d4 (patch)
treec91bee0467728e26a3ab2b06fce2d27db8e99983 /gcc/cpphash.c
parent96e3d3b7074bc4b9e41ff776c9e2dbb26f348076 (diff)
downloadgcc-e2f9a79f86f078c40323984d2ee549e1ba2b19d4.tar.gz
* cpplex.c (cpp_output_tokens, cpp_scan_buffer_nooutput): New public
interfaces. (safe_fwrite, output_line_command): New static functions. (cpp_expand_to_buffer): Now private to cpplib. (cpp_scan_buffer): Take a printer. * cpphash.h: Update prototypes. * cpplib.h: Update prototypes. (cpp_printer): New. (cpp_buffer): Remove last_nominal_fname. (cpp_reader): Remove lineno. * cppmain.c: Use a cpp_printer. * fix-header.c: No need to inhibit line commands. Call cpp_start_read with no printer. * cpperror.c (cpp_notice_from_errno): Provide default name. * cppfiles.c (make_IHASH, _cpp_fake_ihash): New functions. (find_include_file, cpp_read_file): Use make_IHASH. (file_cleanup): Set control_macro and clear input_stack_listing_current here. (_cpp_execute_include): Don't output entering-file marker. * cpphash.c (special_symbol): Look for the line number in the buffer, not the reader. (_cpp_macroexpand): No need to disable line commands. (_cpp_dump_definition): No need to generate line commands. (dump_hash_helper): Remove excess newline from output. * cppinit.c (dump_special_to_buffer): No need to generate line commands. (cpp_printer_init): New. (cpp_start_read): Take a printer, and start it up if it's not NULL. No need to generate line commands. (cpp_finish): Expect no buffers stacked at all. Take a printer argument, and flush the output buffer if it's not NULL. * cpplex.c (_cpp_lex_token): Return EOF if there's no buffer. Don't put two hashes at the beginning of an assertion. (cpp_get_token): Don't increment pfile->lineno or emit line commands here. Return EOF if there's no buffer when we get EOF. * cpplib.c (do_define, skip_if_group): No need to disable line commands. (_cpp_output_line_command): Delete function. (do_line): Don't emit line commands here, but set things up so they will be emitted if necessary. Use _cpp_fake_ihash to make unique nominal_fnames if necessary. (do_elif, do_else, _cpp_handle_eof): Call cpp_error_with_line with 0 for column, not -1. (_cpp_handle_eof): Don't set the control macro here. Don't clear input_stack_listing_current here. Don't emit line commands. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33159 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r--gcc/cpphash.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index e9d20b372f7..bead2140c06 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -911,7 +911,7 @@ special_symbol (hp, pfile)
case T_SPECLINE:
ip = cpp_file_buffer (pfile);
CPP_RESERVE (pfile, 10);
- sprintf (CPP_PWRITTEN (pfile), "%u", CPP_BUF_LINE (pfile));
+ sprintf (CPP_PWRITTEN (pfile), "%u", CPP_BUF_LINE (ip));
CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
return;
@@ -1025,7 +1025,6 @@ _cpp_macroexpand (pfile, hp)
/* Skip over the opening parenthesis. */
CPP_OPTION (pfile, discard_comments)++;
- CPP_OPTION (pfile, no_line_commands)++;
pfile->no_macro_expand++;
pfile->no_directives++;
@@ -1058,7 +1057,6 @@ _cpp_macroexpand (pfile, hp)
}
while (token == CPP_COMMA);
CPP_OPTION (pfile, discard_comments)--;
- CPP_OPTION (pfile, no_line_commands)--;
pfile->no_macro_expand--;
pfile->no_directives--;
if (token != CPP_RPAREN)
@@ -1221,9 +1219,9 @@ _cpp_macroexpand (pfile, hp)
if (args[ap->argno].expand_length < 0)
{
args[ap->argno].expanded = CPP_WRITTEN (pfile);
- cpp_expand_to_buffer (pfile,
- ARG_BASE + args[ap->argno].raw,
- args[ap->argno].raw_length);
+ _cpp_expand_to_buffer (pfile,
+ ARG_BASE + args[ap->argno].raw,
+ args[ap->argno].raw_length);
args[ap->argno].expand_length
= CPP_WRITTEN (pfile) - args[ap->argno].expanded;
@@ -1611,9 +1609,6 @@ _cpp_dump_definition (pfile, sym, len, defn)
long len;
DEFINITION *defn;
{
- if (pfile->lineno == 0)
- _cpp_output_line_command (pfile, same_file);
-
CPP_RESERVE (pfile, len + sizeof "#define ");
CPP_PUTS_Q (pfile, "#define ", sizeof "#define " -1);
CPP_PUTS_Q (pfile, sym, len);
@@ -1691,7 +1686,7 @@ _cpp_dump_definition (pfile, sym, len, defn)
if (*x == '\r') x += 2, i -= 2;
if (i > 0) CPP_PUTS (pfile, x, i);
}
- if (pfile->lineno == 0)
+ if (CPP_BUFFER (pfile) == 0 || ! pfile->done_initializing)
CPP_PUTC (pfile, '\n');
CPP_NUL_TERMINATE (pfile);
}
@@ -1706,10 +1701,7 @@ dump_hash_helper (h, p)
cpp_reader *pfile = (cpp_reader *)p;
if (hp->type == T_MACRO)
- {
- _cpp_dump_definition (pfile, hp->name, hp->length, hp->value.defn);
- CPP_PUTC (pfile, '\n');
- }
+ _cpp_dump_definition (pfile, hp->name, hp->length, hp->value.defn);
return 1;
}