使用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.h1 3 4
#1 <命令行> 中2
#1hello.c
#1/usr/include/stdio.h1 3 4
#27/usr/include/stdio.h3 4
#1/usr/include/features.h1 3 4
#374/usr/include/features.h3 4
这些数字可以帮助调试器显示行号。所以我对第一列的猜测是列#2文件的行号。但是下面的数字是做什么的?
文件名后面的数字是标志:
1:表示新文件的开始。
2:表示返回到文件(包含另一个文件后) p>
3:这表示以下文本来自系统头文件,因此应禁止某些警告。
4:这表示应将以下文本视为包含在隐式 externC
块中。
资料来源: https ://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
I am trying to understand the compiling process. We can see the preprocessor intermediate file by using:
gcc -E hello.c -o hello.i
or
cpp hello.c > hello.i
I roughly know what the preprocessor does, but I have difficulties understanding the numbers in some of the lines. For example:
# 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
The numbers can help debugger to display the line numbers. So my guess for the first column is the line number for column #2 file. But what do the following numbers do?
The numbers following the filename are flags:
1: This indicates the start of a new file.
2: This indicates returning to a file (after having included another file).
3: This indicates that the following text comes from a system header file, so certain warnings should be suppressed.
4: This indicates that the following text should be treated as being wrapped in an implicit extern "C"
block.
Source: https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
这篇关于使用gcc编译C时,预处理的.i文件中的数字意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!