Closed
Bug 829993
Opened 12 years ago
Closed 11 years ago
nsCSSRenderingBorders.cpp:907:21: warning: variable 'borderRenderStyle' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla28
Tracking | Status | |
---|---|---|
firefox28 | --- | fixed |
People
(Reporter: dholbert, Assigned: jaas)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [qa-])
Attachments
(2 files)
798 bytes,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
1.80 KB,
patch
|
dbaron
:
review-
|
Details | Diff | Splinter Review |
Build warning:
{
../../../../layout/base/nsCSSRenderingBorders.cpp:907:21: warning: variable 'borderRenderStyle' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
NS_FOR_CSS_SIDES (i) {
^~
../../../../layout/base/nsStyleConsts.h:22:76: note: expanded from macro 'NS_FOR_CSS_SIDES'
#define NS_FOR_CSS_SIDES(var_) for (mozilla::css::Side var_ = NS_SIDE_TOP; var_ <= NS_SIDE_LEFT; var_++)
^
../../../../layout/base/nsCSSRenderingBorders.cpp:916:7: note: uninitialized use occurs here
if (borderRenderStyle == NS_STYLE_BORDER_STYLE_NONE ||
^~~~~~~~~~~~~~~~~
../../../../layout/base/nsCSSRenderingBorders.cpp:907:21: note: remove the condition if it is always true
NS_FOR_CSS_SIDES (i) {
^
../../../../layout/base/nsStyleConsts.h:22:76: note: expanded from macro 'NS_FOR_CSS_SIDES'
#define NS_FOR_CSS_SIDES(var_) for (mozilla::css::Side var_ = NS_SIDE_TOP; var_ <= NS_SIDE_LEFT; var_++)
^
../../../../layout/base/nsCSSRenderingBorders.cpp:899:28: note: initialize the variable 'borderRenderStyle' to silence this warning
uint8_t borderRenderStyle;
^
= '\0'
1 warning generated.
}
This is visible in e.g. the context in this build log (though it's not responsible for the build failure there -- it just happens to be in the same area of the shortlog):
https://tbpl.mozilla.org/php/getParsedLog.php?id=18748969&tree=Mozilla-Inbound
Looks like we probably want to initialize borderRenderStyle to NS_STYLE_BORDER_STYLE_NONE (?)
This code dates back to this cset:
https://hg.mozilla.org/mozilla-central/rev/f34a9f851cd1#l4.669
from bug 424423.
Assignee: nobody → joshmoz
Attachment #813982 -
Flags: review?(dbaron)
Comment on attachment 813982 [details] [diff] [review]
Fix v1.0
I'd rather not make changes like this; I think it's more valuable to gave valgrind warnings when there are real problems than cover them up to silence compiler warnings when the compiler isn't able to analyze the code fully.
Attachment #813982 -
Flags: review?(dbaron) → review-
Comment 3•11 years ago
|
||
Is there another way we can silence the clang warning, with a #pragma maybe?
Comment 5•11 years ago
|
||
Not the prettiest thing to behold, but this squelches the warning.
Attachment #8339781 -
Flags: review?(dbaron)
Comment on attachment 8339781 [details] [diff] [review]
alternate patch, wrap pragmas around borderRenderStyle to squelch compiler warning
This is even uglier; I guess I'd rather take Josh's patch.
Attachment #8339781 -
Flags: review?(dbaron) → review-
Attachment #813982 -
Flags: review- → review+
Comment 7•11 years ago
|
||
Pushed Josh's patch to inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b395bc2b9ba9
Comment 8•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
Assignee: nobody → joshmoz
Target Milestone: --- → mozilla28
status-firefox28:
--- → fixed
Whiteboard: [qa-]
You need to log in
before you can comment on or make changes to this bug.
Description
•