On Wednesday 28 January 2015 18:18:51 Marko Käning wrote:
> Hi Milian,
> 
> On 28 Jan 2015, at 16:59 , Milian Wolff <m...@milianw.de> wrote:
> > OK, can you tell me how to tweak cppcheckExtraArgs for individual
> > projects,
> > e.g. kdevplatform for now?
> 
> for this project currently exists this file:
> ---
> $ cd PATH_TO_BUILD-KDE-ORG
> $ cat config/build/kdevplatform/kf5-qt5.cfg
> [DEFAULT]
> configureExtraArgs=-DBUILD_COVERAGE=ON
> 
> [QualityCheck]
> runCppcheck=True
> 
> ---
> which ensures that cppcheck is run at all.
> 
> 
> Now you simply add your additional arguments ‘-foo' and ‘-bar' to
> cppcheckExtraArgs like this: ---
> $ cat config/build/kdevplatform/kf5-qt5.cfg
> [DEFAULT]
> configureExtraArgs=-DBUILD_COVERAGE=ON
> 
> [QualityCheck]
> runCppcheck=True
> cppcheckExtraArgs=-foo -bar
> 
> ---
> and commit it back to the production branch of b-k-o [1].

Thanks!

I only grepped for kdevplatform, and did not try to find anything that has it 
in its name ;-) My bad!

OK, so it's easy enough to add ignored paths, which I'll commit now. But I 
wonder about the defines. Ben, why does the global config explicitly define

-DKDE_IMPORT -DKDE_EXPORT 

in cppcheckCommand? By default, cppcheck would otherwise go over all defines 
and ignore those that include #error - which would be exactly what I want in 
kdevelop code. If instead -D is to be used, then we'd suddenly need to add 
/all/ defines there. This triggers one error in KDevelop.

Additionally, tons of files are ignored b/c the export macros are now 
generated in the build folder, which is not added to the include paths. Should 
we then add all include paths to cppcheck manually, and globally? Or does 
someone know a better approach here? I only see the option to write a custom 
script which gets the defines and include paths from the CMake-generated 
compile_commands.json and then runs cppcheck on each target with the 
configuration it gets from there. Still needs some hacks though to work 
properly (i.e. I need to define __linux__ manually etc. pp., to prevent errors 
in Qt headers that try to detect the system).

For now, I'll just add more defines to the extra args, but I'd like to start 
the discussion on how to handle this better in the future.

Bye

-- 
Milian Wolff
m...@milianw.de
http://milianw.de

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to