Wind River Compiler 4 (gcc (C) および g++ (C++)) を使用していますが、すべてのプロジェクトを問題なくコンパイルできます。ここで、Coverity Static Analysis を使用してコードをチェックする必要があります。特定のコンパイラを構成しました。C コード (gcc) では問題はなく、解析を実行できますが、C++ コード (g++) では多くのエラーが発生しました。
.../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)
^
インライン名前空間のような C++11 固有の機能のようですが、コードはこれらの機能を使用していません。上記のエラーは、HelloWorld コードで生成されます。
#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;
}
g++ オプションを使用して C++ 標準を設定しようとしました
-std=c++98
しかし、結果は変わりません。
Test-Code は大きなビルド階層にありますが、Coverity の手順は次のようになります。
- ターゲットと環境セット (Wind River 4 Linux)
- きれいにする
- コンパイラのディレクトリとタイプを使用した cov-configure
- 単独で動作する正しい「make all」コマンドを使用した cov-build
- cov-分析
- if (no_error) cov-commit-defects
また、cov-build 中にすべての「インライン名前空間」を「名前空間」に置き換えるように Coverity を構成しました ( --ppp-translator replace/inline namespace/namespace
)。インライン エラーは消えましたが、この過負荷エラーがさらに発生し、正常にビルドされません。また、同じ方法で「C++」を削除しようとしましたが、うまくいきませんでした。常により多くのエラーが発生します。
ここで何が問題なのか、誰にも分かりますか?また、Coverity ビルドをエラーなしで入手するにはどうすればよいですか? C++ 標準ヘッダーを無視するように Coverity を構成することはできるかもしれませんが、その方法はわかりません。