const struct line_map *map = linemap_lookup (&line_table, src_loc);
size_t to_file_len = strlen (map->to_file);
- unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
+ unsigned char *to_file_quoted =
+ (unsigned char *) alloca (to_file_len * 4 + 1);
unsigned char *p;
print.src_line = SOURCE_LINE (map, src_loc);
p = cpp_quote_string (to_file_quoted,
(unsigned char *) map->to_file, to_file_len);
*p = '\0';
- fprintf (print.outf, "# %u \"%s\"%s", print.src_line,
+ fprintf (print.outf, "# %u \"%s\"%s",
+ print.src_line == 0 ? 1 : print.src_line,
to_file_quoted, special_flags);
if (map->sysp == 2)
fputs ((const char *) NODE_NAME (node), print.outf);
putc ('\n', print.outf);
- print.src_line++;
+ if (linemap_lookup (&line_table, line)->to_line != 0)
+ print.src_line++;
}
static void
pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
{
size_t to_file_len = strlen (dir);
- unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
+ unsigned char *to_file_quoted =
+ (unsigned char *) alloca (to_file_len * 4 + 1);
unsigned char *p;
/* cpp_quote_string does not nul-terminate, so we have to do it ourselves. */
int fd, const char *orig_name ATTRIBUTE_UNUSED)
{
c_common_read_pch (pfile, name, fd, orig_name);
-
+
fprintf (print.outf, "#pragma GCC pch_preprocess \"%s\"\n", name);
print.src_line++;
}