3

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?

1 Answer 1

5

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.
Sign up to request clarification or add additional context in comments.

8 Comments

and what line number would it signify because i see many files included with the same line number... am i missing some obvious thing here?
# 1 "/usr/include/stdio.h" 1 3 4, # 28 "/usr/include/stdio.h" 3 4, # 1 "/usr/include/features.h" 1 3 4, # 324 "/usr/include/features.h" 3 4
@ArunKumar Based on your flags this just shows that a new file was opened
@ArunKumar no, it is exactly the same. # 1 "/usr/include/stdio.h" 1 3 4 means /usr/include/stdio.h was opened and we are at line number 1
@ArunKumar depends on the context but line number of the referenced file, in my example /usr/include/stdio.h
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.