Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging information in GCC preprocessor output

I was inspecting the preprocessed output generated by GCC, and I see a lot of these in the .i file that I generated using the -save-temps flag:

# 8 "/usr/include/i386-linux-gnu/gnu/stubs.h" 2 3 4

What do the numbers before and after the absolute path of stubs.h mean? It seems to be some kind of debugging information that is inserted by the preprocessor and allows the compiler to issue error messages referring to this information. These lines do not affect the program itself, but what specifically is each number for?

like image 269
ArunMKumar Avatar asked Jun 18 '26 06:06

ArunMKumar


1 Answers

Based on the documentation the number before the filename is the line number. The numbers after the file name are a flag and mean the following:

  • 1 indicates the start of a new file.
  • 2 indicates returning to a file (after having included another file).
  • 3 indicates that the following text comes from a system header file, so certain warnings should be suppressed.
  • 4 indicates that the following text should be treated as being wrapped in an implicit extern "C" block.
like image 148
Ulrich Dangel Avatar answered Jun 19 '26 21:06

Ulrich Dangel