Skip to content

Fix #15282 (donate-cpu: old Cppcheck version is compiled with -DNDEBUG but head is not, so the results can't be compared) - #9085

Merged
danmar merged 1 commit into
cppcheck-opensource:mainfrom
cppchecksolutions:donate-cpu-undebug
Nov 28, 2026
Merged

danmar merged 1 commit into
cppcheck-opensource:mainfrom
cppchecksolutions:donate-cpu-undebug

Conversation

@danmar

@danmar danmar commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

The Makefile of release versions adds -DNDEBUG but the Makefile on main does not. Therefore the old version was compiled without assertions and head with assertions, and an assertion failure in head was reported as a crash that did not happen in the old version. Compile all versions with -UNDEBUG so the results can be compared.

…G but head is not, so the results can't be compared)

The Makefile of release versions adds -DNDEBUG but the Makefile on main
does not. Therefore the old version was compiled without assertions and
head with assertions, and an assertion failure in head was reported as a
crash that did not happen in the old version. Compile all versions with
-UNDEBUG so the results can be compared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dmcppcheck dmcppcheck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review

The flag works on fresh builds: the Makefile compile rules put $(CPPFLAGS) (which holds the release -DNDEBUG) before $(CXXFLAGS), so -UNDEBUG wins and assertions are back on. The fix does not reach clients that already have an old-version binary, though. donate-cpu.py skips any non-main tree-<ver> whose binary exists, and compile_version() returns early when has_binary() is true. So existing donors keep the -DNDEBUG build of the old version, and the old-vs-head crash comparisons stay wrong until the server announces a new old version or the donor deletes the tree by hand. Bumping CLIENT_VERSION does not invalidate those binaries. I found no other problems.

Comments

# Comment By Where Status
1 Existing clients keep their old -DNDEBUG binary; the new flags are never used for it AI review tools/donate_cpu_lib.py:222 🆕 New

@danmar, please fix, resolve or reply to the open and new comments: #1.

Testing

This PR only changes Python, so I did not build cppcheck or testrunner. python3 -m py_compile tools/donate_cpu_lib.py passes.

Flag precedence: I copied the release Makefile pattern from tools/dmake/dmake.cpp (override CPPFLAGS += -DNDEBUG, compile rule $(CXX) $(CPPFLAGS) $(CXXFLAGS)) into a small Makefile and built a program that calls assert(0):

make CXXFLAGS='-O2 -g -w -UNDEBUG'
g++ -DNDEBUG -O2 -g -w -UNDEBUG -o a a.cpp
./a -> a: a.cpp:2: int main(): Assertion `0' failed.  (rc=134)

So assertions are enabled again in a fresh build.

Stale binaries: I found this by reading the code, not by running it:

  • tools/donate-cpu.py:184-186 skips any non-main version whose binary exists ("No need to check Cppcheck-{} for changes - binary already exists").
  • donate_cpu_lib.compile_version() returns early when has_binary() is true.

So a donor who already built the old version never rebuilds it with the new flags.


Automated review of c350675 by Claude. The pull request was built and tested locally.

Comment thread tools/donate_cpu_lib.py Resolved
@danmar
danmar merged commit 7578129 into cppcheck-opensource:main Nov 28, 2026
74 checks passed
@danmar
danmar deleted the donate-cpu-undebug branch November 28, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants