I use the Wind River Compiler 4 compiler (gcc (C) and g ++ (C ++)) and it will compile all my projects without problems. Now I have to use Static Analysis to check the code. I configured specific compilers. There are no problems for C code (gcc), and I can start the analysis, but for C ++ code (g ++) I got a lot of errors:
.../c++config.h", line 214: error #40: expected an identifier inline namespace __gnu_cxx_ldbl128 { } ^ .../c++config.h", line 214: error #326: inline specifier allowed on function declarations only inline namespace __gnu_cxx_ldbl128 { } ^ .../c++config.h", line 214: error #65: expected a ";" inline namespace __gnu_cxx_ldbl128 { } ^ .../include/string.h", line 76: error #312: cannot overload functions distinguished by return type alone extern __const void *memchr (__const void *__s, int __c, size_t __n) ^ .../include/string.h", line 116: error #312: cannot overload functions distinguished by return type alone extern "C++" __const void *memchr (__const void *__s, int __c, size_t __n) ^
It seems that some C ++ 11 specific functions, such as the built-in namespace, but the code does not use these functions. The errors mentioned above are generated using HelloWorld-Code:
#include "stdio.h" #include "util.h" #include <string> #include "string.h" using namespace std; int main() { printf("Hello World, C++ version: %d.%d.%d\r\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__); return 0; }
I tried to set the C ++ standard with the g ++ option
-std=c++98
but the result has not changed.
Test-Code is in a large build hierarchy, but the steps for Coverity are as follows:
- target and env set (Wind River 4 Linux)
- make clean
- cov-configure with parameter and compiler type
- cov-build with the right do-it-all command that works on its own
- SOU analysis
- if (no_error) cov-commit-errors
I also created Coverity to replace the entire "built-in namespace" with a "namespace" during cov-build ( --ppp-translator replace/inline namespace/namespace
). Inline errors have disappeared, but it causes more errors during overload and without failures. Also tried to remove "C ++" in the same way, but did not work, there are always more errors.
Does anyone have any idea what the problem is? And how can I get Coverity build without errors? Maybe I can configure Coverity to ignore the standard C ++ headers, but now I donβt know how to do this?