Skip to content

fix #13993: simplecpp: bump to 1.4.4 #7650

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ jobs:
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json --enable=internal lib || ec=1
# check gui with qt settings
mkdir b2
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b2 -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b2 -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB -DQT_FEATURE_shortcut -DQT_FEATURE_tooltip -DQT_FEATURE_statustip --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1
# self check test and tools
./cppcheck $selfcheck_options $cppcheck_options -Ifrontend -Icli test/*.cpp || ec=1
./cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/selfcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Self check (unusedFunction)
if: false # TODO: fails with preprocessorErrorDirective - see #10667
run: |
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr -DQT_FEATURE_shortcut -DQT_FEATURE_tooltip -DQT_FEATURE_statustip
env:
DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 1
Expand All @@ -105,7 +105,7 @@ jobs:
# TODO: find a way to report unmatched suppressions without need to add information checks
- name: Self check (unusedFunction / no test)
run: |
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr -DQT_FEATURE_shortcut -DQT_FEATURE_tooltip -DQT_FEATURE_statustip
env:
DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 1
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
- name: Self check (unusedFunction / no test / no cli)
if: false # TODO: the findings are currently too intrusive
run: |
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest_nocli/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest_nocli/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr -DQT_FEATURE_shortcut -DQT_FEATURE_tooltip -DQT_FEATURE_statustip
env:
DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 1
Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:
- name: Self check (unusedFunction / corpus / no test / callgrind)
run: |
# TODO: fix -rp so the suppressions actually work
valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr 2>callgrind.log || (cat callgrind.log && false)
valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr -DQT_FEATURE_shortcut -DQT_FEATURE_tooltip -DQT_FEATURE_statustip 2>callgrind.log || (cat callgrind.log && false)
cat callgrind.log
callgrind_annotate --auto=no > callgrind.annotated.log
head -50 callgrind.annotated.log
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json frontend || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -Ifrontend cli || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json --enable=internal lib || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA -DQT_FEATURE_shortcut -DQT_FEATURE_tooltip -DQT_FEATURE_statustip --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli -Ifrontend test/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
Expand Down
2 changes: 2 additions & 0 deletions cfg/qt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5428,6 +5428,8 @@
<define name="Q_LOGGING_CATEGORY(name,...)" value=""/>
<define name="QT_FORWARD_DECLARE_CLASS(name)" value="class name;"/>
<define name="QT_FORWARD_DECLARE_STRUCT(name)" value="struct name;"/>
<define name="QT_VERSION_CHECK(major, minor, patch)" value="((((major) &amp; 0xff) &lt;&lt; 16) | (((minor) &amp; 0xff) &lt;&lt; 8) | ((patch) &amp; 0xff))"/>
<define name="QT_CONFIG(feature)" value="(1/QT_FEATURE_##feature == 1)"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this.. if the QT_FEATURE is not defined then there will be a unclear preprocessorErrorDirective warning it seems? I fear that it will force our users to configure a whole bunch of QT_FEATURE macros.. how about (QT_FEATURE_##feature == 1) instead?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like this is out of scope for this PR but;

I think it can be unfortunate to copy paste macros as is from library headers if it will create stronger dependency on library internals.. that will more or less remove the benefit of the library and the headers could have been included directly instead to get the real macros instead..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea with having a division by zero is that it will generate a compile error if the macro isn't defined. But I suppose that's not something cppcheck needs to do. So just checking ==1 might be better.

I'm don't know the qt build system very well, but if the feature macros will be added in a compilation database, that should be fine. But then I guess I shouldn't have had to add those manually in the CI... I can try to reproduce and create a ticket.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be unfortunate to copy paste macros as is from library headers if it will create stronger dependency on library internals.. that will more or less remove the benefit of the library and the headers could have been included directly instead to get the real macros instead..

copy and pasting from licensed headers has other implications. but let's not discuss that right now.

There is a way to getting the actual macro values pointed out here: https://trac.cppcheck.net/ticket/8956#comment:10. But that seems to be the approach for the internal defines. I did not find the ticket about source defined ones.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually that is the way to do it:

$ gcc -E -dM $(pkg-config --cflags-only-I Qt6Core) a.cpp | grep QT_CONFIG
#define QT_CONFIG(feature) (1/QT_FEATURE_ ##feature == 1)

<!-- https://doc.qt.io/qt-6/qqmlintegration-h-qtqml-proxy.html -->
<define name="QML_ADDED_IN_VERSION(MAJOR, MINOR)" value=""/>
<define name="QML_ANONYMOUS" value=""/>
Expand Down
1 change: 1 addition & 0 deletions cfg/wxwidgets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@
<define name="wxCHECK_MSG(condition, retValue, msg)" value=""/>
<define name="wxCHECK_RET(condition, retValue)" value=""/>
<define name="wxVERSION_STRING" value="&quot;wxVersionString&quot;"/>
<define name="wxCHECK_VERSION(major,minor,release)" value="(wxMAJOR_VERSION &gt; (major) || (wxMAJOR_VERSION == (major) &amp;&amp; wxMINOR_VERSION &gt; (minor)) || (wxMAJOR_VERSION == (major) &amp;&amp; wxMINOR_VERSION == (minor) &amp;&amp; wxRELEASE_NUMBER &gt;= (release)))"/>
<define name="wxIMAGE_OPTION_QUALITY" value="wxString(&quot;quality&quot;)"/>
<define name="wxIMAGE_OPTION_FILENAME" value="wxString(&quot;FileName&quot;)"/>
<define name="wxIMAGE_OPTION_RESOLUTION" value="wxString(&quot;Resolution&quot;)"/>
Expand Down
Loading