使用 gcc 编译 C 时,预处理后的 .i 文件中的数字是什么意思?

What do the numbers mean in the preprocessed .i files when compiling C with gcc?

我想了解编译过程。我们可以使用以下命令查看预处理器中间文件:

gcc -E hello.c -o hello.i

cpp hello.c > hello.i

我大致知道预处理器的作用,但我很难理解某些行中的数字。例如:

 # 1 "/usr/include/stdc-predef.h" 1 3 4
 # 1 "<command-line>" 2
 # 1 "hello.c"
 # 1 "/usr/include/stdio.h" 1 3 4
 # 27 "/usr/include/stdio.h" 3 4
 # 1 "/usr/include/features.h" 1 3 4
 # 374 "/usr/include/features.h" 3 4

数字可以帮助调试器显示行号。所以我对第一列的猜测是第 2 列文件的行号。但是下面的数字有什么作用?

文件名后面的数字是标志:

1:表示新文件的开始。

2:这表示返回到一个文件(在包含另一个文件之后)。

3: 这表明以下文本来自系统头文件,因此应抑制某些警告。

4:这表示以下文本应被视为包含在隐式 extern "C" 块中。

来源:https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html