Closed
Bug 1123527
Opened 10 years ago
Closed 9 years ago
Fix problems found by cppcheck
Categories
(Core :: General, defect)
Core
General
Tracking
()
RESOLVED
FIXED
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
Details
Attachments
(8 files, 1 obsolete file)
(deleted),
patch
|
ben.tian
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
glandium
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
jhford
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
ehsan.akhgari
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
mcmanus
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
dholbert
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
jesup
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
dholbert
:
review+
n.nethercote
:
checkin+
|
Details | Diff | Splinter Review |
cppcheck finds some interesting stuff that is worth fixing. Generally the fixes are tiny so I'm going to create a single bug report for lots of fixes rather than dozens of tiny bugs reports.
Assignee | ||
Comment 1•10 years ago
|
||
cppcheck identified the extra ')' at the end of these macros. This code must
not be compiled in any of our standard configurations.
Attachment #8551563 -
Flags: review?(btian)
Assignee | ||
Comment 2•10 years ago
|
||
cppcheck says:
> b2g/app/nsBrowserApp.cpp:251: error: Uninitialized variable: gotCounters
> browser/app/nsBrowserApp.cpp:637: error: Uninitialized variable: gotCounters
It's a false positive because one of XP_WIN and XP_UNIX is always defined, but
it doesn't hurt to make that fact clearer.
Attachment #8551568 -
Flags: review?(mh+mozilla)
Comment 3•10 years ago
|
||
Comment on attachment 8551563 [details] [diff] [review]
Fix syntax error in BT_WARNING and BT_LOGD
Review of attachment 8551563 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM. Thanks for finding the nit.
Attachment #8551563 -
Flags: review?(btian) → review+
Assignee | ||
Comment 4•10 years ago
|
||
cppcheck found this. Not important, but doesn't hurt to fix it.
Attachment #8551570 -
Flags: review?(jhford)
Assignee | ||
Comment 5•10 years ago
|
||
I think these undefined variables don't matter because it's a static analysis
input, but defining them does stop cppcheck from complaining.
Attachment #8551571 -
Flags: review?(ehsan)
Comment 6•10 years ago
|
||
Comment on attachment 8551568 [details] [diff] [review]
Added #error cases for impossible platforms
Review of attachment 8551568 [details] [diff] [review]:
-----------------------------------------------------------------
::: b2g/app/nsBrowserApp.cpp
@@ +223,5 @@
> #elif defined(XP_WIN)
> IO_COUNTERS ioCounters;
> gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
> +#else
> + #error "unknown platform"
Capital U to unknown. Add a comment that this is to make cppcheck happy, because a casual reader might end up wanting to remove the useless #else if he doesn't know where it comes from.
Attachment #8551568 -
Flags: review?(mh+mozilla) → review+
Assignee | ||
Comment 7•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8551563 -
Flags: checkin+
Assignee | ||
Updated•10 years ago
|
Attachment #8551568 -
Flags: checkin+
Assignee | ||
Updated•10 years ago
|
Keywords: leave-open
Assignee | ||
Comment 8•10 years ago
|
||
Attachment #8551593 -
Flags: review?(mcmanus)
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
Comment on attachment 8551570 [details] [diff] [review]
Fix a trivial leak
Review of attachment 8551570 [details] [diff] [review]:
-----------------------------------------------------------------
Cool!
Attachment #8551570 -
Flags: review?(jhford) → review+
Updated•10 years ago
|
Attachment #8551593 -
Flags: review?(mcmanus) → review+
Comment 11•10 years ago
|
||
Comment on attachment 8551571 [details] [diff] [review]
Initialized some locals in TestNoArithmeticExprInArgument.cpp
Review of attachment 8551571 [details] [diff] [review]:
-----------------------------------------------------------------
Is there any way to instruct cppcheck to not look at the test files in this directory? These files are never built, only syntax-parsed: <https://dxr.mozilla.org/mozilla-central/source/build/clang-plugin/tests/Makefile.in#5>
But I guess this is harmless (and useless. ;-)
Attachment #8551571 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 12•10 years ago
|
||
> Is there any way to instruct cppcheck to not look at the test files in this
> directory?
Yes, the -i option can be used to ignore files and/or directories.
Assignee | ||
Comment 13•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8551570 -
Flags: checkin+
Assignee | ||
Updated•10 years ago
|
Attachment #8551571 -
Flags: checkin+
Assignee | ||
Updated•10 years ago
|
Attachment #8551593 -
Flags: checkin+
Comment 14•10 years ago
|
||
Assignee | ||
Comment 15•10 years ago
|
||
cppcheck found this.
Attachment #8552837 -
Flags: review?(dholbert)
Assignee | ||
Comment 16•10 years ago
|
||
cppcheck found these.
Attachment #8552848 -
Flags: review?(jwatt)
Comment 17•10 years ago
|
||
Comment on attachment 8552837 [details] [diff] [review]
Fix syntax error when NS_COORD_IS_FLOAT is defined
Review of attachment 8552837 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks! r=me
Attachment #8552837 -
Flags: review?(dholbert) → review+
Updated•10 years ago
|
Version: unspecified → Trunk
Comment 18•10 years ago
|
||
(In reply to Nicholas Nethercote [:njn] from comment #16)
> Created attachment 8552848 [details] [diff] [review]
> Fix syntax errors when DEBUG_LAYOUT is defined
This is an empty patch. Forgot to qref?
Flags: needinfo?(n.nethercote)
Assignee | ||
Comment 19•10 years ago
|
||
cppcheck found this.
Attachment #8552859 -
Flags: review?(rjesup)
Assignee | ||
Comment 20•10 years ago
|
||
Attachment #8552860 -
Flags: review?(jwatt)
Assignee | ||
Updated•10 years ago
|
Attachment #8552848 -
Attachment is obsolete: true
Attachment #8552848 -
Flags: review?(jwatt)
Assignee | ||
Updated•10 years ago
|
Flags: needinfo?(n.nethercote)
Comment 21•10 years ago
|
||
Comment on attachment 8552860 [details] [diff] [review]
Fix syntax errors when DEBUG_LAYOUT is defined
Stealing review, since I'm already here, and this is a trivial fix.
>--- a/layout/xul/nsBoxFrame.cpp
>@@ -1461,23 +1461,24 @@ nsBoxFrame::PaintXULDebugBackground(nsRe
> r.y = r.y + r.height - debugBorder.bottom;
> r.height = debugBorder.bottom;
> drawTarget->FillRect(NSRectToRect(r, appUnitsPerDevPixel), color);
>
> // if we have dirty children or we are dirty
> // place a green border around us.
> if (NS_SUBTREE_DIRTY(this)) {
> nsRect dirty(inner);
>- ColorPattern green(ToDeviceColor(Color0.f, 1.f, 0.f, 1.f)));
>+ ColorPattern green(ToDeviceColor(Color0.f, 1.f, 0.f, 1.f));
^^^^^^^^
You're removing a close-paren here, but really this is missing an open-paren (after "Color" in "Color0.f").
r=me with that open-paren added (and the removed close-paren restored)
Attachment #8552860 -
Flags: review?(jwatt) → review+
Comment 22•10 years ago
|
||
Comment on attachment 8552859 [details] [diff] [review]
Fix syntax error when ERR_REPORTING_SYSLOG is defined
Review of attachment 8552859 [details] [diff] [review]:
-----------------------------------------------------------------
Sure, though we'd never define that.
Attachment #8552859 -
Flags: review?(rjesup) → review+
Assignee | ||
Updated•10 years ago
|
Attachment #8552837 -
Flags: checkin+
Assignee | ||
Updated•10 years ago
|
Attachment #8552859 -
Flags: checkin+
Assignee | ||
Updated•10 years ago
|
Attachment #8552860 -
Flags: checkin+
Comment 23•10 years ago
|
||
Assignee | ||
Comment 24•9 years ago
|
||
I've done as much here as I'm going to.
You need to log in
before you can comment on or make changes to this bug.
Description
•