Discussion:
Where are the Predefined Macros defined?
bx L
2018-09-29 10:54:43 UTC
Permalink
Hello everyone,
I notice that gcc has some predefined macros, which can be
obtained with " gcc -dM -E - < /dev/null". I guess many of them are
machine-specified, such as __LDBL_MANT_DIG__. However, I can't find
where these macros are defined when browsing GCC's source codes. I'm
very curious about how these macros are defined.
Any ideas? Thanks.
Andreas Schwab
2018-09-29 11:57:48 UTC
Permalink
Post by bx L
I notice that gcc has some predefined macros, which can be
obtained with " gcc -dM -E - < /dev/null". I guess many of them are
machine-specified, such as __LDBL_MANT_DIG__. However, I can't find
where these macros are defined when browsing GCC's source codes. I'm
very curious about how these macros are defined.
Look for builtin_define, then inspect the context to see where the macro
names are constructed. For example, c-family/c-cppbuiltin.c has a lot
of them.

Andreas.
--
Andreas Schwab, ***@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
bx L
2018-09-29 12:26:03 UTC
Permalink
Cool, thanks!
Post by Andreas Schwab
Post by bx L
I notice that gcc has some predefined macros, which can be
obtained with " gcc -dM -E - < /dev/null". I guess many of them are
machine-specified, such as __LDBL_MANT_DIG__. However, I can't find
where these macros are defined when browsing GCC's source codes. I'm
very curious about how these macros are defined.
Look for builtin_define, then inspect the context to see where the macro
names are constructed. For example, c-family/c-cppbuiltin.c has a lot
of them.
Andreas.
--
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Continue reading on narkive:
Loading...