main.c:
int main() { return 0; }
After preprocessing stage: gcc -E main.c
# 1 "main.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "main.c"
int main() { return 0; }
I know that:
- the first numbers are line numbers of a processed file;
- the "strings" are file names;
- the numbers at the end of lines are described here https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
What does other lines mean? I mean: <built-in>
, <command-line>
and from where /usr/include/stdc-predef.h
is taken?
Here I found this question GCC preprocessing, what are the built-in and command-line lines for? almost "without" answers.
gcc version 8.3.0 (Debian 8.3.0-6)
UPDATED: Explanation of /usr/include/stdc-predef.h
The header file stdc-predef.h
was hardcoded in gcc/config/glibc-c.c
(from git repo):
26 /* Implement TARGET_C_PREINCLUDE for glibc targets. */
27
28 static const char *
29 glibc_c_preinclude (void)
30 {
31 return "stdc-predef.h";
32 }
It is processed in push_command_line_include
of gcc/c-family/c-opts.c
:
1534 /* Give CPP the next file given by -include, if any. */
1535 static void
1536 push_command_line_include (void)
1537 {
1538 /* This can happen if disabled by -imacros for example.
1539 Punt so that we don't set "<command-line>" as the filename for
1540 the header. */
1541 if (include_cursor > deferred_count)
1542 return;
1543
1544 if (!done_preinclude)
1545 {
1546 done_preinclude = true;
1547 if (flag_hosted && std_inc && !cpp_opts->preprocessed)
1548 {
1549 const char *preinc = targetcm.c_preinclude ();
1550 if (preinc && cpp_push_default_include (parse_in, preinc))
1551 return;
1552 }
1553 }
and pseudo-filenames "<built-in>"
and "<command-line>"
are added in c_finish_options
there also.