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.
Tool/software: TI C/C++ Compiler
Running a static code analyzer (like CodeSonar) on Ubuntu 16.04 on a simple TI ARM 16.9.4.LTS compiler program like this:
#include <cstring>
int main()
{
return 0;
}
...gives parse and build errors because of what appears to be missing header files from the embedded and modified "STLport" library that comes with the TI compiler. In fact, for the program shown, there are three types of errors created by the static analyzer:
(i) Missing include file errors (x4) like “s_c__linux.h”, "s_c_stl_mycomp.h", "s_c__native_headers.h", "u_cstring" appear to be genuinely reported by CodeSonar as missing. This is potentially true since they do not exist anywhere on the file system. Can TI provide these header files or what am I missing for a solution here?
(ii) Unable to determine platform type where CodeSonar appears to genuinely report that preprocessor error (x1) by CodeSonar of ‘#error "can't determine endianess"’ is because neither of the endian symbols _STLP_BIG_ENDIAN or _STLP_LITTLE_ENDIAN are defined in file "s_c_features.h" but initial research suggests these are setup by the TI compiler header “./ti-cgt-arm_16.9.4.LTS/lib/src/s_c__ti.h” when __little_endian__” which should be defined in a system file like /usr/include/endian.h but appears not to be the case and perhaps suggests possible platform mismatch or oversight (Ubunti 16.04 and the TI compilers appear to use “__LITTLE_ENDIAN” instead). This needs more investigation.
(iii) Undefined macro where CodeSonar appears to genuinely report the error (x1) of ‘# include _STLP_NATIVE_CPP_C_HEADER(cstring)‘. CodeSonar can legitimately require that the parameter to an include statement be a filename but the reason the symbol _STLP_NATIVE_CPP_C_HEADER is not resolved by the preprocessor would likely be caused by the same issue as item (i) above i.e. missing STLport header files.
Taking the example of the missing s_c__linux.h include file, if you look in the include/s_c__system.h file the include of s_c__linux.h is inside a #if block:Ray Felton said:(i) Missing include file errors (x4) like “s_c__linux.h”
(__linux__) # include <s_c__linux.h> /* # ifdef __KCC # include <s_c__kai.h> # endif */ #elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || \ defined (__WIN16) || defined (WIN16) || defined (_WIN16) # include <s_c__windows.h> #else # include <s_c__ti.h> #endif #if !defined (_STLP_COMPILER) /* Unable to identify the compiler, issue error diagnostic. * Edit <config/stl_mycomp.h> to set STLport up for your compiler. */ # include <s_c_stl_mycomp.h> #endif
I think the problem is that your CodeSonar setup thinks that linux or __linux__ are defined which then causes an include of the s_c__linux.h file to be attempted, which is not part of the TI compiler installation.
Therefore, the definition of the pre-defined symbols used by CodeSonar needs to match the actual pre-defined symbols used by the TI compiler.