And passing compile_commands.json to the cppcheck and seeing the error DISABLE_WARNING(WARN_UNALIGNED_STRUCT)<--- There is an unknown macro here somewhere. Configuration is required. If DISABLE_WARNING is a macro then please configure it.
This issue is not appearing with cppcheck 1.88 version. if I add manually -D__ICCARM__ in compile_commands.json it is not throwing any error. This proving that cppcheck unable to get the compiler defined macro -D__ICCARM__.
How to resolve this issue?
Last edit: Krishna 2021-05-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Then you can add a --library=iccarm.cfg on the command line and Cppcheck should understand this..
But that is a "hack" solution I don't really like it. The --library was not really meant to handle this particular use case. I think we should provide some better configuration.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
We have a macro which are defined based on the toolchain(CC_ARM, __ARMCC_VERSION, __GNUC, ICCARM Etc). below is the snippet of how it is defined.
#if defined(ICCARM)
#define DISABLE_WARNING(x) DO_PRAGMA(diag_suppress = x)
#endif
And passing compile_commands.json to the cppcheck and seeing the error
DISABLE_WARNING(WARN_UNALIGNED_STRUCT)<--- There is an unknown macro here somewhere. Configuration is required. If DISABLE_WARNING is a macro then please configure it.
This issue is not appearing with cppcheck 1.88 version. if I add manually -D__ICCARM__ in compile_commands.json it is not throwing any error. This proving that cppcheck unable to get the compiler defined macro -D__ICCARM__.
How to resolve this issue?
Last edit: Krishna 2021-05-17
hmm.. could you show a piece of your compile_commands.json?
I guess it's enough with one item in the list. Please attach it so it doesn't get changed by some wiki formatting etc..
Please find the attachment.
Hi Daniel,
Can you please reply with suggestions?
hmm.. I am not sure what to do. One possible quick fix is that you create a file
iccarm.cfg
:Then you can add a
--library=iccarm.cfg
on the command line and Cppcheck should understand this..But that is a "hack" solution I don't really like it. The
--library
was not really meant to handle this particular use case. I think we should provide some better configuration.Hi Daniel,
Thanks for reply.
Yes, the above solution wouldn't work for us.
This issue is not there in 1.88v. Is this a bug in 2.4.1v?
Is there a way to raise bug to fix?
Thanks.