Closed Bug 208868 Opened 17 years ago Closed 17 years ago

New nsCSSDataBlock.cpp produces "may be used uninitialized" warning.

Categories

(Core :: CSS Parsing and Computation, defect, minor)

x86
Linux
defect
Not set
minor

Tracking

()

VERIFIED FIXED

People

(Reporter: mozilla-bugs, Assigned: dbaron)

References

()

Details

Attachments

(1 file, 2 obsolete files)

Brad Tbox shows a new "may be used uninitialized" warning:

+content/html/style/src/nsCSSDataBlock.cpp:349
+ `void*copy' might be used uninitialized in this function

The warning was introduced by the bug 125246 check-in. In comes from a
"notreached" default case in a switch statement and is trivial to fix (patch
coming up in a moment).
I'm curious to see what the "simple" fix is.  I'd rather not add real code
that's never used.  (I almost used gotos here instead of the inner switch.)
(I guess one could put the unreachable default case first, and without a |break;|.)
Comment on attachment 125265 [details] [diff] [review]
Initialize the variable in the "default" switch case.

Is this reasonable? Thanks!
Attachment #125265 - Flags: review?(dbaron)
Attachment #125265 - Flags: review?(dbaron) → review-
We shouldn't necessarily add code size and runtime cost.  If gcc is failing to
do enough flow analysis to determine that the default: case is never reached,
then it might be better to hold out for a gcc fix, and live with the warning.

/be
Comment on attachment 125270 [details] [diff] [review]
since people annoy me when I produce warnings, replace with gotos

Actually, this increases code size, probably since gcc doesn't optimize it as
well...
Attachment #125270 - Attachment is obsolete: true
Attached patch patchSplinter Review
Attachment #125265 - Attachment is obsolete: true
Fix by checkin of bug 208872 to trunk, 2003-06-10 15:08 -0700.
Status: NEW → RESOLVED
Closed: 17 years ago
Depends on: 208872
Resolution: --- → FIXED
V, warning disappeared from brad TBox
Status: RESOLVED → VERIFIED
Blocks: 126457
No longer blocks: 59652, 132145
You need to log in before you can comment on or make changes to this bug.