4.2. C/C++ Source Migration Aid Diagnostics

When migrating a C29x C/C++ application project from using the TI C28x compiler to using the c29clang compiler you may have instances of TI-specific pragmas, pre-defined macro symbols, or intrinsics that are supported by the cl2000 compiler, but not the c29clang compiler.

To make your C/C++ source code more portable, you will need to locate instances of TI-specific pragmas, pre-defined macro symbols, and intrinsics in your source code and convert them into supported counterparts.

To help with this process, the c29clang compiler emits a diagnostic when it encounters the use of a proprietary TI pre-defined macro symbol, pragma, or intrinsic and provides information about how that use can be safely transformed into a functionally equivalent alternative, if one exists. In cases where there is no functionally equivalent alternative to replace an instance of a proprietary TI pre-defined macro symbol, pragma, or intrinsic, the c29clang compiler emits a diagnostic to inform you about the presence of that proprietary TI mechanism.

Let’s consider a couple of examples …

4.2.1. Proprietary TI Pragmas

The proprietary TI pragma FUNC_CANNOT_INLINE has a valid alternative, so if the c29clang compiler encounters the following line of code:

#pragma FUNC_CANNOT_INLINE

The c29clang compiler will emit the following diagnostic:

warning: pragma FUNC_CANNOT_INLINE is a legacy TI pragma and not
supported in clang compilers. use '__attribute__((always_inline))'
instead

For more information about how many of the commonly occurring proprietary TI pragmas can be converted into attribute form, please see the Pragmas and Attributes section.

4.2.2. Proprietary TI Pre-Defined Macro Symbols

The proprietary TI pre-defined macro symbol __TMS320C28XX__ is an example of a pre-defined macro symbol that can be used to configure C29x-specific code in an application, but this pre-defined macro symbol is not supported by c29clang and needs to be replaced by a functionally equivalent expression. Specifically, when the following line of code is encountered by the c29clang compiler:

#if defined(__TMS320C28XX__)
...
#endif

the c29clang compiler will emit the following diagnostic:

warning: __TMS320C28XX__ is a legacy TI macro that is not defined
in clang compilers and will evaluate to 0, use '(__C29_ARCH == 0)
instead [-Wti-macros]

The warning can then be averted by replacing the __TMS320C28XX__ symbol reference with the following:

#if (__C29_ARCH == 1)

However, there are other proprietary TI pre-defined macro symbols, like __TMS320C28XX_VCRC__ , that do not have a viable alternative, so the following code:

#if defined(__TMS320C28XX_VCRC__ )

yields the following diagnostic when encountered by the c29clang compiler:

warning: '__TMS320C28XX_VCRC__ ' is a legacy TI macro and not supported in clang
compilers

For more information about how many of the proprietary TI pre-defined macro symbols can be converted into their functionally equivalent form, please refer to the Pre-Defined Macro Symbols section.

4.2.3. Proprietary TI Intrinsics

The proprietary TI intrinsic “__lmin” is an example of an cl2000 compiler intrinsic that has a viable alternative form, so when the c29clang compiler encounters the following function:

long __lmin(long dst, long src)

The c29clang compiler does not provide diagnostics. However, the diagnostic checks provided by the c29clang-tidy utility suggest converting this intrinsic to the following:

int __builtin_c29_i32_min32_d(int, int)

int c29_min(int a, int b) {
  return __builtin_c29_i32_min32_d(a, b);
}

Not all cl2000 intrinsics are as easy as “__lmin” to migrate to a functionally equivalent c29clang form. For more details on how specific cl2000 intrinsics can be migrated, please refer to the Intrinsics and Built-in Functions section.

4.2.4. Turning Off the Migration Aid Diagnostics

The migration aid diagnostics for use of proprietary TI macro symbols, pragmas, and intrinsics are enabled by default in the c29clang compiler. The following c29clang compiler options can be specified to selectively turn off the migration aid diagnostic categories:

  • -Wno-ti-pragmas : to suppress migration aid diagnostics for proprietary TI pragmas

  • -Wno-ti-macros : to suppress migration aid diagnostics for proprietary TI pre-defined macro symbols

  • -Wno-ti-intrinsics : to suppress migration aid diagnostics for proprietary TI intrinsics