0

我对 PC-Lint 及其配置文件有疑问。在该文件中,我从以下内容开始:

// --- Rules --------------------------------------------------------------------------------------

// warning policy
au-misra3.lnt                    // (MISRA C 2012 (TM) - 6/12/14)
au-misra-cpp-alt.lnt             // (MISRA C++ 2008 using 9000 level messages - 6/12/14)

该项目混有 .c 和 .cpp 文件。如何告诉 PC-Lint 仅在 C-Files 上使用 C-Policy,在 CPP-Files 上使用 CPP-Policy?

提前致谢!

4

2 回答 2

1

这是一个有趣的问题。如果您正在执行单元检查(选项 -u),您当然可以设置构建环境以对不同的源文件使用不同的选项文件。但除此之外,我认为这应该可行:

-save
au-misra3.lnt
[list of C files]
-restore

au-misra-cpp-alt.lnt
[list of C++ files]
于 2015-04-04T07:24:01.227 回答
0

另一个想法是使用 -header(lintoptions.h) 来包含您的 lint 选项。包含文件可能是这样的:

//lint -restore_at_end
#ifdef __cplusplus
//lint -indirect(au-misra-cpp-alt.lnt)
#else
//lint -indirect(au-misra3.lnt)
#endif

让我们知道这是否有效。

于 2015-04-04T07:27:15.030 回答