GCC Wikia
Advertisement

このページを編集する際は,編集に関する方針に従ってください.[]

概要[]

引数[]

実装[]

234 /* Output a line marker for logical line LINE.  Special flags are "1"
235    or "2" indicating entering or leaving a file.  */
236 static void
237 print_line (source_location src_loc, const char *special_flags)
238 {
239   /* End any previous line of text.  */
240   if (print.printed)
241     putc ('\n', print.outf);
242   print.printed = 0;
243 
244   if (!flag_no_line_commands)
245     {
246       const struct line_map *map = linemap_lookup (&line_table, src_loc);
247 
248       size_t to_file_len = strlen (map->to_file);
249       unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
250       unsigned char *p;
251 
252       print.src_line = SOURCE_LINE (map, src_loc);
253 
254       /* cpp_quote_string does not nul-terminate, so we have to do it
255          ourselves.  */
256       p = cpp_quote_string (to_file_quoted,
257                             (unsigned char *) map->to_file, to_file_len);
258       *p = '\0';
259       fprintf (print.outf, "# %u \"%s\"%s",
260                print.src_line == 0 ? 1 : print.src_line,
261                to_file_quoted, special_flags);
262 
263       if (map->sysp == 2)
264         fputs (" 3 4", print.outf);
265       else if (map->sysp == 1)
266         fputs (" 3", print.outf);
267 
268       putc ('\n', print.outf);
269     }
270 }



リンク元

Advertisement