Best way to handle oddball header #includes for Cppcheck Report?
lukebenes at hotmail.com
Wed Sep 12 16:50:03 UTC 2018
I am in the process of teaching cppcheck about our source tree. So far I have reduced the number of warnings from ~9000 to ~100. In order for our weekly Cppcheck Report to benefit from these, I need to automate the process. Here is the command I used to list all of our include directories:
$ find . -type d \( -name "inc" -o -name "include" \) |sort > inc.txt
This cuts the warning from 9000 to 300, but there are some oddball #includes that this misses. Here is an example from 'vcl/qt5/Qt5Bitmap.cxx':
#include <Qt5Bitmap.hxx><--- Include file: not found.
The complete path of this file is: ./vcl/inc/qt5/Qt5Bitmap.hxx
And my script already taught cppcheck about: ./vcl/inc
So I need to manually add: vcl/inc/qt5
So my question is how should this be remedied?
A) Change the include path to follow all 99% of the other include
B) Move the include file to an include folder
C) Or Keep a list of these oddballs and append them the results of my find command?
D) Write a smarter find command. Ideas?
Is there a guideline on include naming? Many of these oddballs seem to be in folders that have been recently moved around the source tree. (vcl/inc/qt5 was just moved a few months ago)
So far, here is a list of the oddball include locations needed outside of those my find command located:
#include <Qt5Bitmap.hxx> : vcl/inc/qt5
#include <charttest.hxx> : chart2/qa/extras
#include <gst/interfaces/xoverlay.h> : avmedia/source/gstreamer
#include <: I forget :(> : include/rtl
More information about the LibreOffice