-
Notifications
You must be signed in to change notification settings - Fork 1.5k
cfg/qt.cfg - Change the Q_D definition to avoid false positives #7629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add support for Qt macros Q_DECL_DEPRECATED and Q_DECL_DEPRECATED_X for people use the Qt library.
Change the O_D macro definition by moving the 'const' qualifier to the front of the statement. Without this change we get false positives "style: Variable 'd' can be declared as pointer to const [constVariablePointer]" The current definition follows Qt correctly as we see this define in the `QtCore/qtclasshelpermacros.h` file: Q_D(Class) Class##Private * const d = d_func() but apparently cppcheck doesn't properly recognize that as a const variable pointer.
Can you add a test in |
yes, I can add a test. however, I think a larger problem is that cppcheck seems to not like |
some simple sample code that demonstrate a problem would be nice. we should like the first code as far as I know. |
Create new `QThread`s for each check, as well as for whole-program analysis, instead of restarting finished threads which is undefined behavior (see https://doc.qt.io/qt-6/qthread.html#create). Fixes Trac #13852.
In cppcheck html report, points to libera.chat rather than freenode.net
…h `--report-type=misra-cpp-2023` (danmar#7624)
…onstructor is implicitly defined (danmar#7637)
also cleaned up some `externals` includes and the order.
I wrote a test here but it isn't showing any problems. in my test, I did run into a checkLibraryFunction issue for |
hmm.. you already identified that it's from Q_DECLARE_PRIVATE if a simple configuration is provided like:
does it work better then? That configuration is not ideal. Cppcheck can not know what value it returns then. However I am not sure that providing the template would help neither the type deduction can be too complex. |
I am not 100% sure that providing the exact real replacement lists for various macros is always a great idea. Maybe sometimes it's preferable to simplify the code. |
Change the O_D macro definition by moving the 'const' qualifier
to the front of the statement.
Without this change we get false positives "style: Variable 'd' can be
declared as pointer to const [constVariablePointer]"
The current definition follows Qt correctly as we see this
define in the
QtCore/qtclasshelpermacros.h
file:#define Q_D(Class) Class##Private * const d = d_func()
but apparently cppcheck doesn't properly recognize that
as a const variable pointer.