Closed Bug 59675 Opened 25 years ago Closed 14 years ago

Occurences of uninitialized variables being used before being set (in layout)

Categories

(Core :: Layout, defect)

defect
Not set
trivial

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: rich.burridge, Assigned: sgautherie)

References

Details

Attachments

(4 files, 5 obsolete files)

For more details on this problem, see: http://bugzilla.mozilla.org/show_bug.cgi?id=59652 This bug is just for the warnings in various source files in the Layout module: /layout/base/src/nsDocumentViewer.cpp nsDocumentViewer.cpp:650: warning: `nsresult rv' might be used uninitialized in ---- /layout/html/base/src/nsBlockFrame.cpp nsBlockFrame.cpp:1524: warning: `PRTime start' might be used uninitialized in this function nsBlockFrame.cpp:1525: warning: `PRInt32 ctc' might be used uninitialized in this function nsBlockFrame.cpp:6385: warning: `PRTime start' might be used uninitialized in this function nsBlockFrame.cpp:6386: warning: `PRInt32 drawnLines' might be used uninitialized in this function ---- /layout/html/base/src/nsFrame.cpp nsFrame.cpp:3306: warning: `class nsIFrame * thisBlock' might be used uninitialized in this function nsFrame.cpp:3336: warning: `class nsIFrame * thisBlock' might be used uninitialized in this function ---- /layout/html/base/src/nsHTMLReflowState.cpp nsHTMLReflowState.cpp:249: warning: `nsCSSFrameType frameType' might be used uninitialized in this function ---- /layout/html/base/src/nsImageMap.cpp nsImageMap.cpp:955: warning: `nsresult rv' might be used uninitialized in this function ---- /layout/html/base/src/nsPresShell.cpp nsPresShell.cpp:3805: warning: `class nsIFrame * lastInFlow' might be used uninitialized in this function nsPresShell.cpp:5104: warning: `PRTime beforeReflow' might be used uninitialized in this function nsPresShell.cpp:5104: warning: `PRTime afterReflow' might be used uninitialized ---- /layout/html/base/src/nsSplittableFrame.cpp nsSplittableFrame.cpp:94: warning: `class nsSplittableFrame * firstInFlow' might be used uninitialized in this function nsSplittableFrame.cpp:106: warning: `class nsSplittableFrame * lastInFlow' might be used uninitialized in this function ---- /layout/html/base/src/nsTextFrame.cpp nsTextFrame.cpp:1004: warning: `nscolor foreColor' might be used uninitialized in this function nsTextFrame.cpp:1158: warning: `class nsIFrame * lastInFlow' might be used uninitialized in this function nsTextFrame.cpp:1511: warning: `nscolor overColor' might be used uninitialized in this function nsTextFrame.cpp:1512: warning: `nscolor underColor' might be used uninitialized nsTextFrame.cpp:1513: warning: `nscolor strikeColor' might be used uninitialized in this function nsTextFrame.cpp:3307: warning: `PRBool keepSearching' might be used uninitialized in this function ---- /layout/html/document/src/nsFrameSetFrame.cpp nsFrameSetFrame.cpp:977: warning: `PRBool * verBordersVis' might be used uninitialized in this function nsFrameSetFrame.cpp:978: warning: `class nsHTMLFramesetBorderFrame ** verBorders' might be used uninitialized in this function nsFrameSetFrame.cpp:979: warning: `nscolor * verBorderColors' might be used uninitialized in this function nsFrameSetFrame.cpp:980: warning: `PRBool * horBordersVis' might be used uninitialized in this function nsFrameSetFrame.cpp:981: warning: `class nsHTMLFramesetBorderFrame ** horBorders' might be used uninitialized in this function nsFrameSetFrame.cpp:982: warning: `nscolor * horBorderColors' might be used uninitialized in this function nsFrameSetFrame.cpp:983: warning: `PRInt32 * childTypes' might be used uninitialized in this function nsFrameSetFrame.cpp:987: warning: `struct nsBorderColor * childBorderColors' might be used uninitialized in this function nsFrameSetFrame.cpp:988: warning: `nscolor borderColor' might be used uninitialized in this function ---- /layout/html/forms/src/nsIsIndexFrame.cpp nsIsIndexFrame.cpp:189: warning: `nsresult result' might be used uninitialized in this function nsIsIndexFrame.cpp:340: warning: `nsresult result' might be used uninitialized in this function ---- /layout/html/style/src/nsCSSParser.cpp nsCSSParser.cpp:2299: warning: `enum nsCSSUnit units' might be used uninitialized in this function ---- /layout/html/style/src/nsCSSRendering.cpp nsCSSRendering.cpp:225: warning: `nscoord outsideEdge' might be used uninitialized in this function nsCSSRendering.cpp:225: warning: `nscoord insideEdge' might be used uninitialized in this function nsCSSRendering.cpp:225: warning: `nscoord outsideTL' might be used uninitialized in this function nsCSSRendering.cpp:225: warning: `nscoord insideTL' might be used uninitialized nsCSSRendering.cpp:225: warning: `nscoord outsideBR' might be used uninitialized in this function nsCSSRendering.cpp:226: warning: `nscoord insideBR' might be used uninitialized ---- /layout/html/style/src/nsCSSStyleRule.cpp nsCSSStyleRule.cpp:1653: warning: `enum nsSystemAttrID sysID' might be used uninitialized in this function nsCSSStyleRule.cpp:2786: warning: `enum nsStyleContentType type' might be used uninitialized in this function ---- /layout/html/style/src/nsStyleUtil.cpp nsStyleUtil.cpp:276: warning: `PRInt32 * column' might be used uninitialized in ---- /layout/html/table/src/nsCellMap.cpp nsCellMap.cpp:948: warning: `PRInt32 endColIndex' might be used uninitialized in this function ---- /layout/html/table/src/nsTableOuterFrame.cpp nsTableOuterFrame.cpp:1096: warning: `nsresult rv' might be used uninitialized in this function ---- /layout/html/table/src/nsTableRowFrame.cpp nsTableRowFrame.cpp:1309: warning: `nsresult rv' might be used uninitialized in ---- /layout/html/table/src/nsTableRowGroupFrame.cpp nsTableRowGroupFrame.cpp:1775: warning: `class nsIFrame * tempFrame' might be used uninitialized in this function ---- /layout/html/table/src/nsTableBorderCollapser.cpp nsTableBorderCollapser.cpp:796: warning: `struct nsStyleSpacing * winningStyleBorder' might be used uninitialized in this function ---- /layout/xml/document/src/nsXMLContentSink.cpp nsXMLContentSink.cpp: In method `nsresult nsXMLContentSink::DidBuildModel(int)':nsXMLContentSink.cpp:261: warning: `nsresult rv' might be used uninitialized in ---- /layout/xul/base/src/nsBoxToBlockAdaptor.cpp nsBoxToBlockAdaptor.cpp:503: warning: `nsresult rv' might be used uninitialized ../../../../dist/include/nsAReadableString.h:1085: warning: `int whichString' might be used uninitialized in this function ---- /layout/xul/base/src/nsBoxFrame.cpp nsBoxFrame.cpp:1418: warning: `nscoord onePixel' might be used uninitialized in ----
Blocks: 59652
I will at least start with the XML stuff.
Assignee: clayton → heikki
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Appart from "PRTime x = 0;" having to be changed to "PRTime x = LL_ZERO();" (to compile on the mac) the attached diff looks fine with me, r=jst
sr=waterson
Assignee: heikki → pollmann
Status: ASSIGNED → NEW
Checked in fixes to docviewer, blockframe, imagemap & xml. Passing on to pollmann who seems to be in charge of nsFrameSetFrame.cpp at least. Feel free to fix any other places you feel comfortable with... Please fix cases where the compiler is actually wrong (i.e. we do not use variable unitialized even if the compiler warns). Safe warnings make it harder to find the real warnings...
Whiteboard: fix in hand
Checked in fixes to nsFrameSetFrame.cpp and nsIsIndexFrame.cpp Handing off to Marc for changes to core layout, CC'ing Chris for table changes.
Assignee: pollmann → attinasi
Target Milestone: mozilla0.9 → ---
Target Milestone: --- → mozilla0.9.9
Currently (http://tinderbox.mozilla.org/SeaMonkey/warn1010706660.6236.html) I see the following warnings: layout/base/src/nsBidiPresUtils.cpp:166 `nsresult rv' might be used uninitialized in this function layout/base/src/nsBidiPresUtils.cpp:222 `PRInt32 contentOffset' might be used uninitialized in this function layout/base/src/nsBidiPresUtils.cpp:228 `PRBool isTextFrame' might be used uninitialized in this function layout/base/src/nsBidiPresUtils.cpp:585 `nscoord dWidth' might be used uninitialized in this function layout/base/src/nsPresContext.cpp:327 `struct nsFont * font' might be used uninitialized in this function layout/html/base/src/nsBlockFrame.cpp:707 `class nsSpaceManager * spaceManager' might be used uninitialized in this function layout/html/base/src/nsBlockFrame.cpp:708 `class nsSpaceManager * oldSpaceManager' might be used uninitialized in this function layout/html/base/src/nsFrame.cpp:3692 `class nsIFrame * newFrame' might be used uninitialized in this function layout/html/base/src/nsHTMLReflowState.cpp:308 `nsCSSFrameType frameType' might be used uninitialized in this function layout/html/base/src/nsPresShell.cpp:6246 `PRTime beforeReflow' might be used uninitialized in this function `PRTime afterReflow' might be used uninitialized in this function layout/html/base/src/nsSplittableFrame.cpp:109 `class nsSplittableFrame * firstInFlow' might be used uninitialized in this function layout/html/base/src/nsSplittableFrame.cpp:121 `class nsSplittableFrame * lastInFlow' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:1172 `nscolor foreColor' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:1351 `class nsIFrame * lastInFlow' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:1736 `nscolor overColor' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:1737 `nscolor underColor' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:1738 `nscolor strikeColor' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:1742 `nscolor overrideColor' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:3082 `const char * text' might be used uninitialized in this function layout/html/base/src/nsTextFrame.cpp:4064 `PRBool keepSearching' might be used uninitialized in this function layout/html/style/src/nsCSSRendering.cpp:1753 `int shrinkage' might be used uninitialized in this function `int startRadius' might be used uninitialized in this function`int endRadius' might be used uninitialized in this function layout/html/style/src/nsCSSRendering.cpp:257 `int outsideEdge' might be used uninitialized in this function `int insideEdge' might be used uninitialized in this function`int outsideTL' might be used uninitialized in this function`int insideTL' might be used uninitialized in this function`int outsideBR' might be used uninitialized in this function layout/html/style/src/nsCSSRendering.cpp:258 `int insideBR' might be used uninitialized in this function layout/html/table/src/BasicTableLayoutStrategy.cpp:830 `nscoord divisor' might be used uninitialized in this function layout/html/table/src/BasicTableLayoutStrategy.cpp:831 `nscoord numerator' might be used uninitialized in this function layout/html/table/src/nsCellMap.cpp:996 `PRInt32 endColIndex' might be used uninitialized in this function layout/html/table/src/nsTableFrame.cpp:5091 `void * value' might be used uninitialized in this function layout/html/table/src/nsTableFrame.cpp:5092 `void (* dtorFunc)(nsIPresContext *, nsIFrame *, nsIAtom *, void *)' might be used uninitialized in this function layout/xul/base/src/nsBoxFrame.cpp:1647 `nscoord onePixel' might be used uninitialized in this function layout/xul/base/src/nsBoxObject.cpp:68 `class nsISupports * foundInterface' might be used uninitialized in this function layout/xul/base/src/nsBoxToBlockAdaptor.cpp:582 `nsresult rv' might be used uninitialized in this function layout/xul/base/src/nsTextBoxFrame.cpp:331 `nscolor overColor' might be used uninitialized in this function layout/xul/base/src/nsTextBoxFrame.cpp:332 `nscolor underColor' might be used uninitialized in this function layout/xul/base/src/nsTextBoxFrame.cpp:333 `nscolor strikeColor' might be used uninitialized in this function layout/xul/base/src/outliner/src/nsOutlinerContentView.cpp:190 `class nsISupports * foundInterface' might be used uninitialized in this function layout/xul/base/src/outliner/src/nsOutlinerSelection.cpp:271 `class nsISupports * foundInterface' might be used uninitialized in this function
Target Milestone: mozilla0.9.9 → mozilla1.1
Attached file 48 warning in layout (obsolete) —
These are the warnings listed in http://tinderbox.mozilla.org/SeaMonkey/warn1012854360.1135.html (Mon, 04 Feb 2002 15:26 EST) I am very surprized this was postponed until after 1.0 - these warning should be relatively easy to fix and fixing them is quite likely to make Mozilla more stable...
Attachment #19566 - Attachment is obsolete: true
Attachment #19569 - Attachment is obsolete: true
Attachment #28670 - Attachment is obsolete: true
Whiteboard: fix in hand
Keywords: mozilla1.0
Currently (http://tinderbox.mozilla.org/SeaMonkey/warn1015442340.18286.html - Wed, 06 Mar 2002 14:19 EST) there are 44 "xxx might be use uninitialized" warnings in layout: 6 in layout/base/src: nsBidi.cpp - 1 nsBidiPresUtils.cpp - 4 nsPresContext.cpp - 1 15 in layout/html/base/src : nsBlockFrame.cpp - 2 nsFrame.cpp - 1 nsHTMLReflowState.cpp - 1 nsPresShell.cpp - 1 nsSplittableFrame.cpp - 2 nsTextFrame.cpp - 8 3 in layout/html/style/src: nsCSSRendering.cpp - 3 5 in layout/html/table/src: BasicTableLayoutStrategy.cpp - 2 nsCellMap.cpp - 3 8 in layout/xul/base/src: nsBoxFrame.cpp - 1 nsBoxObject.cpp - 1 nsBoxToBlockAdaptor.cpp - 1 nsTextBoxFrame.cpp - 3 nsOutlinerContentView.cpp - 1 nsOutlinerSelection.cpp - 1
Attachment #67797 - Attachment is obsolete: true
Today's check-in for bug 126473 fixed 3 warnings in layout/xul, there are now 41 of them left in layout.
Summary: Occurances of uninitialized variables being used before being set. → Occurances of uninitialized variables being used before being set (in layout)
Depends on: 132141
Depends on: 132145
Today's checkin to bug 137094 fixed the two layout/html/base/src/nsBlockFrame.cpp warnings. Current list of files in layout with "may be used uninitialized" warnings: layout/base/src/nsBidi.cpp layout/base/src/nsBidiPresUtils.cpp layout/base/src/nsPresContext.cpp layout/html/base/src/nsFrame.cpp layout/html/base/src/nsHTMLReflowState.cpp layout/html/base/src/nsPresShell.cpp layout/html/base/src/nsSplittableFrame.cpp layout/html/base/src/nsTextFrame.cpp layout/html/style/src/nsCSSRendering.cpp layout/html/table/src/BasicTableLayoutStrategy.cpp layout/html/table/src/nsCellMap.cpp layout/xul/base/src/nsBoxFrame.cpp layout/xul/base/src/nsBoxToBlockAdaptor.cpp layout/xul/base/src/nsTextBoxFrame.cpp
Summary: Occurances of uninitialized variables being used before being set (in layout) → Occurences of uninitialized variables being used before being set (in layout)
Depends on: 155539
->Misc Code
Assignee: attinasi → misc
Component: Layout → Layout: Misc Code
QA Contact: petersen → nobody
How about an up-to-date list here?
Priority: P3 → --
Target Milestone: mozilla1.1alpha → ---
The current list: /layout/base/src/nsPresContext.cpp /layout/html/base/src/nsFrame.cpp /layout/html/base/src/nsHTMLReflowState.cpp /layout/html/base/src/nsPresShell.cpp /layout/html/base/src/nsTextFrame.cpp /layout/html/style/src/nsCSSRendering.cpp /layout/xul/base/src/nsTextBoxFrame.cpp
Count by file: layout/base/src/nsPresContext.cpp - 1 layout/html/base/src/nsFrame.cpp - 3 layout/html/base/src/nsHTMLReflowState.cpp - 1 layout/html/base/src/nsPresShell.cpp - 1 layout/html/base/src/nsTextFrame.cpp - 8 layout/html/style/src/nsCSSRendering.cpp - 9 layout/xul/base/src/nsTextBoxFrame.cpp - 3
Attachment #72865 - Attachment is obsolete: true
No longer blocks: 179819
No longer depends on: 155539
(for the record) Bug 230397 patch Bv1b belonged to this bug.
Depends on: 230397
Depends on: 155539
No longer depends on: 132145
Attachment #19566 - Attachment description: Fix docviewer, blockframe, imagemap, xml → (Av1) Fix docviewer, blockframe, imagemap, xml
Attachment #19569 - Attachment description: Previous patch with LL_ZERO → (Av1b) Previous patch with LL_ZERO [Checked in: Comment 6]
Attachment #28670 - Attachment description: patch nsFrameSetFrame and nsIsIndexFrame (hand edits, not valid patch) → (Bv1) patch nsFrameSetFrame and nsIsIndexFrame (hand edits, not valid patch) [Checked in: Comment 8]
No longer depends on: 132141
Attached patch (Cv1) <nsTextBoxFrame.cpp> (obsolete) — Splinter Review
This patch comes from bug 132141 (which was resolved as duplicate...): The compiler is confused by all the |if()| :-|
Assignee: core.layout.misc-code → gautheri
Status: NEW → ASSIGNED
Comment on attachment 146149 [details] [diff] [review] (Cv1) <nsTextBoxFrame.cpp> I have no compiler: Could you compile/test/review this patch ? Thanks.
Attachment #146149 - Flags: review?(jag)
Severity: normal → trivial
Keywords: mozilla1.0
Comment on attachment 146149 [details] [diff] [review] (Cv1) <nsTextBoxFrame.cpp> Another way to tackle this is to merge these two pieces of code and do the drawing where currently the color is assigned. That way you can completely get rid of overColor, underColor and strikeColor. hasDecorations seems to be superfluous too.
Attachment #146149 - Attachment is obsolete: true
Attachment #146149 - Flags: review?(jag)
Depends on: 241568
Attached patch (Cv1b) <nsTextBoxFrame.cpp> (obsolete) — Splinter Review
Cv1, with comment 21 suggestion(s).
Cv1b, with |vis| reuse.
Attachment #146972 - Attachment is obsolete: true
Comment on attachment 146974 [details] [diff] [review] (Cv1c) <nsTextBoxFrame.cpp> I wonder if line 434 could be fully removed: {{ 433 if (buffer) { 434 const nsStyleVisibility* vis = GetStyleVisibility(); 435 nsBidiDirection direction = }} as there is line 331 {{ 330 // Align our text within the overall rect by checking our text-align property. 331 const nsStyleVisibility* vis = GetStyleVisibility(); 332 const nsStyleText* textStyle = GetStyleText(); }} or if it does need to be called again.
Attachment #146974 - Flags: review?(jag)
Comment on attachment 146974 [details] [diff] [review] (Cv1c) <nsTextBoxFrame.cpp> I wonder if line 434 could be fully removed: {{ 433 if (buffer) { 434 const nsStyleVisibility* vis = GetStyleVisibility(); 435 nsBidiDirection direction = }} as there is line 331 {{ 330 // Align our text within the overall rect by checking our text-align property. 331 const nsStyleVisibility* vis = GetStyleVisibility(); 332 const nsStyleText* textStyle = GetStyleText(); }} or if it does need to be called again. I have no compiler: Could you compile/test/review this patch ? Thanks.
Attachment #19569 - Attachment is obsolete: false
Attachment #28670 - Attachment is obsolete: false
QA Contact: nobody → layout.misc-code
Surprisingly, there is no warning at all in the layout/ code (using gcc4.6.1). Hence closing this bug.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: