SLAU132V October 2004 – February 2020
The compiler maintains and recognizes the predefined macro names listed in Table 2-31.
Macro Name | Description |
---|---|
__DATE__(1) | Expands to the compilation date in the form mmm dd yyyy |
__FILE__(1) | Expands to the current source filename |
__LARGE_CODE_MODEL__ | Defined if --code_model=large is specified |
__LARGE_DATA_MODEL__ | Defined if --data_model=large or −−data_model=restricted is specified |
__LINE__(1) | Expands to the current line number |
__LONG_PTRDIFF_T__ | Defined when --data_model=large is specified. Indicates ptrdiff_t is a long. |
__MSP430__ | Always defined |
__MSP430X__ | Defined if --silicon_version=mspx is specified |
__MSP430X461X__ | Defined if --silicon_version=mspx is specified |
__PTRDIFF_T_TYPE__ | Set to the type of ptrdiff_t. Determined by the --data_model option. |
__signed_chars__ | Defined if char types are signed by default (--plain_char=signed) |
__SIZE_T_TYPE__ | Set to the type of size_t. Determined by the --data_model option. |
__STDC__(1) | Defined to 1 to indicate that compiler conforms to ISO C Standard. See Section 5.1 for exceptions to ISO C conformance. |
__STDC_VERSION__ | C standard macro. |
__STDC_HOSTED__ | C standard macro. Always defined to 1. |
__STDC_NO_THREADS__ | C standard macro. Always defined to 1. |
__TI_COMPILER_VERSION__ | Defined to a 7-9 digit integer, depending on if X has 1, 2, or 3 digits. The number does not contain a decimal. For example, version 3.2.1 is represented as 3002001. The leading zeros are dropped to prevent the number being interpreted as an octal. |
__TI_EABI__ | Defined to 1 if the EABI is enabled (see Section 2.13); otherwise, it is undefined. |
__TI_GNU_ATTRIBUTE_SUPPORT__ | Defined to 1 if GCC extensions are enabled (which is the default) |
__TI_STRICT_ANSI_MODE__ | Defined to 1 if strict ANSI/ISO mode is enabled (the --strict_ansi option is used); otherwise, it is defined as 0. |
__TI_STRICT_FP_MODE__ | Defined to 1 if --fp_mode=strict is used (default); otherwise, it is defined as 0. |
__TIME__(1) | Expands to the compilation time in the form "hh:mm:ss" |
__unsigned_chars__ | Defined if char types are unsigned by default (default or −− plain_char=unsigned) |
__UNSIGNED_LONG_SIZE_T__ | Defined when --data_model=large is specified. Indicates size_t is an unsigned long. |
_INLINE | Expands to 1 if optimization is used (--opt_level or -O option); undefined otherwise. |
You can use the names listed in Table 2-31 in the same manner as any other defined name. For example,
printf ( "%s %s" , __TIME__ , __DATE__);
translates to a line such as:
printf ("%s %s" , "13:58:17", "Jan 14 1997");