Repository navigation
Fix #15282 (donate-cpu: old Cppcheck version is compiled with -DNDEBUG but head is not, so the results can't be compared) - #9085
Conversation
…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
left a comment
There was a problem hiding this comment.
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-186skips any non-main version whose binary exists ("No need to check Cppcheck-{} for changes - binary already exists").donate_cpu_lib.compile_version()returns early whenhas_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.
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.