aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmain.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2002-03-14 18:17:18 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-03-14 18:17:18 +0000
commitdcc229e5a1a7425479e0738cb9e70e8e8a2132da (patch)
tree226bd8664bc5db227069d75069a5198366adb680 /gcc/cppmain.c
parent83a4940733758aa5e49b35ca6cef45f7a5958bf4 (diff)
downloadgcc-dcc229e5a1a7425479e0738cb9e70e8e8a2132da.zip
gcc-dcc229e5a1a7425479e0738cb9e70e8e8a2132da.tar.gz
gcc-dcc229e5a1a7425479e0738cb9e70e8e8a2132da.tar.bz2
cpphash.h (struct lexer_state): Remove line_extension member.
* cpphash.h (struct lexer_state): Remove line_extension member. * cpplib.c (dequote_string, do_linemarker): New functions. (linemarker_dir): New data object. (DIRECTIVE_TABLE): No longer need to interpret #line in preprocessed source. Delete obsolete comment about return values of handlers. (end_directive, directive_diagnostics, _cpp_handle_directive): Don't muck with line_extension. (directive_diagnostics): No need to issue warnings for linemarkers here. (_cpp_handle_directive): Issue warnings for linemarkers here, when appropriate. Dispatch linemarkers to do_linemarker, not do_line. (do_line): Code to handle linemarkers split out to do_linemarker. Convert escape sequences in filename argument, both places. * cppmacro.c (quote_string): Rename cpp_quote_string and export. All callers changed. * cpplib.h (cpp_quote_string): Prototype. * cppmain.c (print_line): Call cpp_quote_string on to_file before printing it. * doc/cpp.texi: Document that escapes are now interpreted in #line and in linemarkers, and that non-printing characters are converted to octal escapes when linemarkers are generated. From-SVN: r50779
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r--gcc/cppmain.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index 503fa30..b8757c7 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -321,8 +321,17 @@ print_line (map, line, special_flags)
print.line = line;
if (! options->no_line_commands)
{
+ size_t to_file_len = strlen (map->to_file);
+ unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
+ unsigned char *p;
+
+ /* cpp_quote_string does not nul-terminate, so we have to do it
+ ourselves. */
+ p = cpp_quote_string (to_file_quoted,
+ (unsigned char *)map->to_file, to_file_len);
+ *p = '\0';
fprintf (print.outf, "# %u \"%s\"%s",
- SOURCE_LINE (map, print.line), map->to_file, special_flags);
+ SOURCE_LINE (map, print.line), to_file_quoted, special_flags);
if (map->sysp == 2)
fputs (" 3 4", print.outf);