This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ARM-CGT: tiarmclang compiler missing __TI_COMPILER_VERSION__ macro

Part Number: ARM-CGT

Hi, I'm running with CCC12.20 and `ti-cgt-armllvm_3.2.0.LTS`. The compiler does not define the `__TI_COMPILER_VERSION__ ` macro like the (offline PDF version) reference manual says it does. See pdf here

The online version of the manual, as I've just discovered, makes no mention of `__TI_COMPILER_VERSION__` . See online version here

The compiler not defining this symbol is concerning because internal compiler files check for it being defined, see the below codeblock for a small snippet. I will also note this breaks backward compatibility with the `armcl` TI compiler which uses this macro.

/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/include/c/stdlib.h
480:#ifdef __TI_COMPILER_VERSION__

/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/include/c/sys/cdefs.h
43:#if defined(__TI_COMPILER_VERSION__)
141:#ifdef __TI_COMPILER_VERSION__
156:#endif /* __TI_COMPILER_VERSION__ */
235:#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) && !defined(__TI_COMPILER_VERSION__)
253:#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) || defined(__TI_COMPILER_VERSION__)
273:#if defined(__TI_COMPILER_VERSION__)
391:#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) || defined(__TI_COMPILER_VERSION__)
397:#if __GNUC_PREREQ__(3, 1) || defined(__TI_COMPILER_VERSION__)
424:#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) && !defined(__TI_COMPILER_VERSION__)
429:    defined(__TI_COMPILER_VERSION__) || ((defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__))
451:#if !defined(__TI_COMPILER_VERSION__)
623:#if defined(__TI_COMPILER_VERSION__) && \
920:#ifdef __TI_COMPILER_VERSION__

/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/include/c/machine/endian.h
95:#if __TI_COMPILER_VERSION__
131:#if __TI_COMPILER_VERSION__

/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/include/c/machine/_types.h
50:#ifdef __TI_COMPILER_VERSION__
143:#ifdef __TI_COMPILER_VERSION__
162:#ifdef __TI_COMPILER_VERSION__
177:#if defined(__TI_COMPILER_VERSION__)

/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/include/c/sys/_stdint.h
35:#if !defined(__TI_COMPILER_VERSION__) ||  !defined(__TMS320C2000__)
57:#if !defined(__TI_COMPILER_VERSION__) ||  !defined(__TMS320C2000__)

/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/include/c/sys/_types.h
37:#if defined(__TI_COMPILER_VERSION__)
68:#if defined(__TI_COMPILER_VERSION__) &&  defined(__TMS320C2000__)
101:#if defined(__TI_COMPILER_VERSION__) && \
138:#ifdef __TI_COMPILER_VERSION__
165:#if defined(__TI_COMPILER_VERSION__)

/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/include/c/sys/types.h
49:#if !defined(__clang__) && !defined(__TI_COMPILER_VERSION__)
69:#if !defined(__TI_COMPILER_VERSION__) ||  !defined(__TMS320C2000__)

Note I ran `/opt/ti/ccs1220/ccs/tools/compiler/ti-cgt-armllvm_3.2.0.LTS/bin/tiarmclang -dM -E -x c /dev/null` to get the output of the compiler's predefined macros. These are the only TI ones I see:

```

#define __ti__ 1
#define __ti_major__ 3
#define __ti_minor__ 2
#define __ti_patchlevel__ 0
#define __ti_version__ 30200

````

  • Hi -- that is correct, the `tiarmclang` compiler does not define this macro. The PDF you post is generated from the online documentation; I only see the macro mentioned (in both instances) in discussing the macros the TI linker defines for certain circumstances (linker command files). There is no claim that the compiler itself supports this macro.

    The compiler not defining this symbol is concerning because internal compiler files check for it being defined, see the below codeblock for a small snippet. I will also note this breaks backward compatibility with the `armcl` TI compiler which uses this macro.

    These headers belong to our C runtime which is shared between our older proprietary compiler (armcl) and tiarmclang.  Users migrating from using `armcl` ought to use the macros you point out from the user guide.

  • Hi Alan,

    I apologize, you're correct, I incorrectly assumed the linker would make `__TI_COMPILER_VERSION__` available in the output files. I do now see that `__ti_version__` is mentioned in the pdf manual. Thank you, this solves my issue!