Repository navigation
Conversation
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no problems. The PR deletes the <use-retval/> line from g_file_set_contents in cfg/gtk.cfg, so cppcheck no longer warns when its return value is ignored. Nothing else changes, and GLib doesn't mark the function as warn-unused-result either, which fits the reasoning. One remark: test/cfg/gtk.c never calls g_file_set_contents, so no test pins the new behaviour.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | No test in test/cfg/gtk.c covers g_file_set_contents | AI review | cfg/gtk.cfg:4065 |
🆕 New (false negative) |
@Tamaranch, please fix, resolve or reply to the open and new comments: #1.
For #1 (false negative), it is enough to create a Trac ticket and link it here. It does not need to be fixed in this PR.
Testing
- Build:
make -j8 cppcheckinpr/built cleanly. I didn't buildtestrunnerbecause the PR changes no C++ code. - Library test: I ran
test/cfg/gtk.cwith the cppcheck options fromtest/cfg/runtests.shplus--library=gtk,--error-exitcode=1and--debug-warnings. It exited with 0 and no output. - Before and after: I ran this file (
t.c) against both the base and the PR versions ofgtk.cfg:
#include <glib.h>
void f(const char *c){
g_file_set_contents("/tmp/x", c, -1, NULL);
gchar *s; gsize n;
g_file_get_contents("/tmp/x", &s, &n, NULL);
}Command: cppcheck --library=/work/{base,pr}/cfg/gtk.cfg --enable=warning t.c
- Base:
ignoredReturnValuefor bothg_file_set_contents()andg_file_get_contents(). - PR:
ignoredReturnValueonly forg_file_get_contents(). This is the intended change. - Not run:
xmllintisn't installed in the container, so I couldn't checkgtk.cfgagainst the RelaxNG schema. Deleting one empty element can't make the file invalid.
Automated review of 6464bff 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 PR only deletes <use-retval/> from g_file_set_contents in cfg/gtk.cfg. The rest of the function's configuration (not-null, not-uninit, strz) still applies. The only gap is the one already raised in C2: test/cfg/gtk.c still has no call to g_file_set_contents.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | No test in test/cfg/gtk.c covers g_file_set_contents | AI review | cfg/gtk.cfg:4065 |
@Tamaranch, please fix, resolve or reply to the open and new comments: #1.
For #1 (false negative), it is enough to create a Trac ticket and link it here. It does not need to be fixed in this PR.
Testing
- Build:
make -j8 cppcheckinpr/built cleanly. I didn't buildtestrunnerbecause the PR changes no C++ code. - Scratch test: I ran
./cppcheck --library=gtk --enable=warning,style --check-library t.con this file:
#include <glib.h>
void f(const char *c){
g_file_set_contents("/tmp/x", c, -1, NULL);
g_file_set_contents(NULL, c, -1, NULL);
}- Line 3 gave no
ignoredReturnValue, which is the intended change. - Line 4 still gave
nullPointer, so the rest of the function's configuration still works. - Library test: I ran
test/cfg/gtk.cwith--library=gtk --check-library. It gave no warnings, onlyunmatchedSuppressionnotes, which come from my options rather than from the exactruntests.shsetup. - Not checked: I didn't build or run
base/, and I didn't checkgtk.cfgagainst the RelaxNG schema.
Automated review of 6464bff 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 PR only deletes <use-retval/> from g_file_set_contents in cfg/gtk.cfg. The function's other checks still work, and gtk.cfg doesn't configure any related function that should change along with it. The one gap was already raised in C1/C2: test/cfg/gtk.c still has no call to g_file_set_contents, so no test pins the new behaviour.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | No test in test/cfg/gtk.c covers g_file_set_contents | AI review | general | |
| 2 | No test in test/cfg/gtk.c covers g_file_set_contents | AI review | cfg/gtk.cfg:4065 |
@Tamaranch, please fix, resolve or reply to the open and new comments: #1, #2.
For #1 and #2 (false negative), it is enough to create a Trac ticket and link it here. It does not need to be fixed in this PR.
Testing
- Build:
make -j8 cppcheckinpr/built cleanly. I didn't buildtestrunnerbecause the PR changes no C++ code. - XML:
gtk.cfgstill parses as XML (checked with Python'sxml.dom.minidom). I didn't check it against the RelaxNG schema. - Scratch test: I ran
./cppcheck --library=gtk --enable=warning,style --check-library t.con this file:
#include <glib.h>
void f(const char *c){
g_file_set_contents("/tmp/x", c, -1, NULL);
g_file_set_contents(NULL, c, -1, NULL);
}- Line 3 gave no
ignoredReturnValue, which is the intended change. - Line 4 still gave
nullPointer, so the function's other checks still work. - Test coverage:
grepfinds no use ofg_file_set_contentsanywhere intest/cfg/.
Automated review of 6464bff 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 PR deletes only the <use-retval/> line from g_file_set_contents in cfg/gtk.cfg. Its other settings (not-null, not-uninit, strz, not-bool) still apply. The one gap was already raised in C1/C2 and is still open: test/cfg/gtk.c has no call to g_file_set_contents, so no test pins the new behaviour.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | No test in test/cfg/gtk.c covers g_file_set_contents | AI review | general | |
| 2 | Add a g_file_set_contents call ignoring the return value to test/cfg/gtk.c | AI review | cfg/gtk.cfg:4065 |
@Tamaranch, please fix, resolve or reply to the open and new comments: #1, #2.
For #1 and #2 (false negative), it is enough to create a Trac ticket and link it here. It does not need to be fixed in this PR.
Testing
- Build:
make -j8 cppcheckinpr/built cleanly. I didn't buildtestrunnerbecause the PR changes no C++ code. - Scratch test: I ran
./cppcheck --library=gtk --enable=warning,style --check-library -q t.con this file:
#include <glib.h>
void f(const char *c){
g_file_set_contents("/tmp/x", c, -1, NULL);
g_file_set_contents(NULL, c, -1, NULL);
}- Line 3 gave no
ignoredReturnValue, which is the intended change. - Line 4 still gave
nullPointer, so the function's other configuration still works. - Library test: I ran
test/cfg/gtk.cwith--library=gtk --check-library --enable=style,information --inline-suppr.- It gave no warnings.
- It printed only
unmatchedSuppressionandnormalCheckLevelMaxBranchesnotes. These come from my options, not from the exactruntests.shsetup. Because--enable=informationwas on, the command exited with 1.
- Test coverage:
grepfinds no use ofg_file_set_contentsanywhere intest/cfg/. - Not checked: I didn't build or run
base/, and I didn't checkgtk.cfgagainst the RelaxNG schema.
Automated review of 6464bff 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 PR deletes only <use-retval/> from g_file_set_contents in cfg/gtk.cfg, and the function's other settings still work. The one gap is still the one raised in C2: test/cfg/gtk.c never calls g_file_set_contents, so no test pins the new behaviour.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | No test in test/cfg/gtk.c covers g_file_set_contents | AI review | cfg/gtk.cfg:4065 |
@Tamaranch, please fix, resolve or reply to the open and new comments: #1.
For #1 (false negative), it is enough to create a Trac ticket and link it here. It does not need to be fixed in this PR.
Testing
- Build:
make -j8 cppcheckinpr/built cleanly. I didn't buildtestrunnerbecause the PR changes no C++ code. - Scratch test: I ran
./cppcheck --library=gtk --enable=warning,style -q t.con this file:
#include <glib.h>
void f(const char *c){
g_file_set_contents("/tmp/x", c, -1, NULL);
g_file_set_contents(NULL, c, -1, NULL);
}- Line 3 gave no
ignoredReturnValue, which is the intended change. - Line 4 still gave
nullPointer, so the function's other checks still work. - Library test: I ran
test/cfg/gtk.cwith--library=gtk --check-library --inline-suppr --enable=style,information. It gave no new warnings. The only output wasunmatchedSuppressionnotes and thenormalCheckLevelMaxBranchesnote, which come from my options rather than from the PR. - Test coverage:
grepfinds no use ofg_file_set_contentsanywhere intest/cfg/. - Not checked: I didn't build or run
base/, and I didn't checkgtk.cfgagainst the RelaxNG schema.
Automated review of 6464bff by Claude. The pull request was built and tested locally.
It is acceptable to write to a file without worrying about the result in general (allowed to fail).
6464bff to
b9dd69f
Compare
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no new problems. The PR removes <use-retval/> from g_file_set_contents in cfg/gtk.cfg. It now also adds a call in test/cfg/gtk.c that ignores the return value. That fixes the earlier review comment (C2) about the missing test: the new line fails with the old config and passes with the new one.
Comments
| # | Comment | By | Where | Status |
|---|---|---|---|---|
| 1 | No test in test/cfg/gtk.c covers g_file_set_contents | AI review | cfg/gtk.cfg:4065 |
✅ Fixed |
Testing
- Build:
make -j8 cppcheckinpr/built cleanly. I didn't buildtestrunnerbecause the PR changes no C++ code. - PR config: I ran
./cppcheck --library=gtk --check-library --enable=style,information --inline-suppr --error-exitcode=1 -q --suppress=missingIncludeSystem --suppress=unmatchedSuppression --suppress=checkersReport --suppress=normalCheckLevelMaxBranches test/cfg/gtk.cinpr/. It printed no warnings and exited with 0. - Base config: I ran the same command with the same binary, but with the base
cfg/gtk.cfgin its cfg folder. It failed on the new test line, which shows that the test pins the change:test/cfg/gtk.c:99:5: warning: Return value of function g_file_set_contents() is not used. [ignoredReturnValue] - Not run: I didn't run the full
test/cfg/runtests.sh, because it needs the GTK headers.
Automated review of b9dd69f by Claude. The pull request was built and tested locally.
It is acceptable to write to a file without worrying about the result in general (allowed to fail).