添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

After I successfully managed to use last Cppcheck version (1.89) I have
several false call of " There is an unknown macro here somewhere.
Configuration is required. If END_SEQ is a macro then please configure it.
",
what is weird is, I'm using other macros from same include file for which I
have no error.

Attachment zip file has been rejected then I put here the files as they
would have been in the zip file:

public/include/Macros.h :

define BEGIN_SEQ do{

define CHECK_EXECUTE(command) if ((static_cast

<bool>(command)) == false) { break; }</bool>

define END_SEQ }while(false);

src/Marsh/Common/Prog/Meta/Toto.cpp :

include "Macros.h"

int Toto()
BEGIN_SEQ
CHECK_EXECUTE(true)
END_SEQ

return 0;

Running following command on folder where include and src folders are
present gives this error:

cppcheck $(find . -name .cpp -o -name .h) --force --platform=unix64
--enable=warning --xml-version=2 --verbose --error-exitcode=0 --std=c++11
--language=c++

In addition I can say the error disappears if I set Toto function as void
returning nothing or if I put for example a printf between END_SEQ
and return
0;
or if I just remove END_SEQ line (of course the code will not build
but there is no such error on other macros).

Could you please check on this ?

Thanks

cppcheck $(find . -name .cpp -o -name .h) --force --platform=unix64
--enable=warning --xml-version=2 --verbose --error-exitcode=0 --std=c++11
--language=c++

I would suggest that you include the public/include path also using -I so Macros.h is found.

If a header is not found then Cppcheck tries to analyse the code as well as it can.

if you add --enable=information --check-config to your command line then I would recommend that you fix so that your own headers are found. Do not include standard headers and library headers (feel free to try it though), it's better to use --library.