Repository navigation
bisect: add another patch (old versions not building with newer compilers) - #9061
Conversation
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no problems. The only change is to the bisect helper script tools/bisect/bisect_common.py. On the first line of lib/programmemory.cpp the PR puts #include <limits> in front of the existing text. In cppcheck that line is the /* that opens the license header, so the result, #include <limits> /*, is a valid directive and the header compiles. The file is restored by the existing git reset --hard after the build, just like the other patches.
Two side notes, neither confirmed as a bug:
- The patch only works because line 1 is a comment. If some old revision started
programmemory.cppwith a directive, such as#include "programmemory.h", the edited line would become#include <limits> #include .... GCC drops the extra tokens with a warning, which the-wbuild flag hides, so that include would be lost. I could not check old revisions because there is no git history in the container.sed -i '1i #include <limits>'would avoid the risk. - The log message has a typo:
programmmemory.
Testing
I did not build cppcheck or testrunner. The PR changes only a Python bisect helper, so neither build would exercise it.
python3 -m py_compile tools/bisect/bisect_common.py: passes.- I ran the PR's sed command on a copy of
pr/lib/programmemory.cpp. Line 1 becomes#include <limits> /*, which is fine. - I ran the same sed command on a small file that starts with a
/* ... */comment and usesstd::numeric_limits.g++ -c -Wall -Wextracompiles it cleanly. - I ran it on a file whose first line is
#include <cstdio>. The result is#include <limits> #include <cstdio>, and g++ reportswarning: extra tokens at end of #include directive. The second include is lost. This does not affect current cppcheck sources, because their first line is a comment.
Automated review of a6bedd7 by Claude. The pull request was built and tested locally.
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no new problems. The second commit switched to sed -i '1i #include <limits>', which addresses both side notes from the earlier automated review: the include no longer depends on line 1 being a comment, and the log message typo is gone. The patch is applied before the build and undone by the existing git reset --hard, the same way as the other patches.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | Prepending to line 1 with s/^/ drops the original first line if it is a directive |
AI review | general | ✅ Fixed |
| 2 | Typo programmmemory in log message |
AI review | general | ✅ Fixed |
Testing
I did not build cppcheck or testrunner. The PR changes only the Python bisect helper, so neither build would exercise it.
- I ran the PR's command,
sed -i '1i #include <limits>', on a file whose first line is#include "a.h". The result is#include <limits>on a line of its own, followed by the unchanged original lines, so the original first line is kept. - I read
tools/bisect/bisect_common.py. The new block is guarded byos.path.isfile, so older revisions withoutlib/programmemory.cppare skipped. The printed message now readspatching lib/programmemory.cpp.
Automated review of 73e1788 by Claude. The pull request was built and tested locally.
|
Thanks for merging. There actually are more problematic commit ranges, so bisecting with gcc >= 13 may still fail due to compilation errors, some of which are not easily patched (see 6f56a95). |
Fix build errors with
g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0