when I try to run cppcheck on a cmake project I get the following errors:
Checking /home/user/builddir/cppcheck/externals/tinyxml/tinyxml2.cpp ...
Bailing out from checking /home/user/builddir/cppcheck/externals/tinyxml/tinyxml2.cpp since there was an internal error: bad macro syntax
1/53 files checked 1% done
.
.
Checking /home/user/builddir/cppcheck/cli/threadexecutor.cpp ...
Bailing out from checking /home/user/builddir/cppcheck/cli/threadexecutor.cpp since there was an internal error: bad macro syntax
53/53 files checked 100% done
to reproduce just run cmake on the cppcheck directory with
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
and afterwards try
cppcheck --project=compile_commands.json
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I fixed the ticket. But I am not sure the compile_commands will always be handled well. How is windows include paths working now? I have trouble testing this. If you can test it out please feel free to do it.
Is it possible to reuse some compile_commands parser? The only open source parser I am aware of is the one built into clang. And that is probably bloated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried it on windows and it does not work well for me :-(
For me when I generate a compile database using cmake in windows, it
uses response files. I did not know about response files and have no
handling for it. I am surprised nobody has complained, maybe these are
not used much in windows. It's not easy to generate a compile database
in windows, you can't just use the DOUTPUT_COMPILE_DATABASE you also
need to use some specific generator. and a workaround if you use cmake
is to generate the visual studio solution instead.
when I try to run cppcheck on a cmake project I get the following errors:
to reproduce just run cmake on the cppcheck directory with
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
and afterwards try
Thanks for reporting this problem! I created this ticket: https://trac.cppcheck.net/ticket/8864
I fixed the ticket. But I am not sure the compile_commands will always be handled well. How is windows include paths working now? I have trouble testing this. If you can test it out please feel free to do it.
Is it possible to reuse some compile_commands parser? The only open source parser I am aware of is the one built into clang. And that is probably bloated.
Your fix works for me. Thanky you.
I don't know about windows include paths.
Great!
I tried it on windows and it does not work well for me :-(
For me when I generate a compile database using cmake in windows, it
uses response files. I did not know about response files and have no
handling for it. I am surprised nobody has complained, maybe these are
not used much in windows. It's not easy to generate a compile database
in windows, you can't just use the DOUTPUT_COMPILE_DATABASE you also
need to use some specific generator. and a workaround if you use cmake
is to generate the visual studio solution instead.
Den ons 28 nov. 2018 kl 16:15 skrev "Müller" s1m3mu3@users.sourceforge.net:
This still seems to be an issue in version 2.2.
With
I get the error
I'm on Linux with cmake using cppcheck with the
--project=compile_commands.json
flag.