Bug 6153 - build failure after WebTextRenderer patch, uninitialized variables
Summary: build failure after WebTextRenderer patch, uninitialized variables
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P1 Normal
Assignee: mitz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-19 18:40 PST by Justin Garcia
Modified: 2005-12-20 13:45 PST (History)
0 users

See Also:


Attachments
Build fix (2.07 KB, patch)
2005-12-19 22:25 PST, mitz
darin: review+
Details | Formatted Diff | Diff
fix more uninitialized variable warnings (1.07 KB, patch)
2005-12-20 13:15 PST, mitz
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Garcia 2005-12-19 18:40:59 PST
Deployment catches a few uninitialized variables in your recent patch:
/Users/justin/Labyrinth/WebKit/WebCoreSupport.subproj/WebTextRenderer.m: In function 
'createATSULayoutParameters':
/Users/justin/Labyrinth/WebKit/WebCoreSupport.subproj/WebTextRenderer.m:1314: warning: 
'firstSmallCap' may be used uninitialized in this function
/Users/justin/Labyrinth/WebKit/WebCoreSupport.subproj/WebTextRenderer.m:1292: warning: 
'substituteRenderer' may be used uninitialized in this function

 I couldn't figure out why firstSmallCap was uninitialized:

            UniCharArrayOffset firstSmallCap;
            if (i == substituteOffset || i == substituteOffset + substituteLength) {
                if (isSmallCap) {
                    isSmallCap = false;
                    initializeATSUStyle(getSmallCapsRenderer(r));
                    ATSUSetRunStyle(layout, getSmallCapsRenderer(r)->_ATSUStyle, firstSmallCap, i - 
firstSmallCap);
                }

 firstSmallCap is an argument to ATSUSetRunStyle, not as a ref or anything, but as a value.  Initializing it 
to 0 made one of the layout tests you added fail.
Comment 1 mitz 2005-12-19 22:25:38 PST
Created attachment 5169 [details]
Build fix

Sorry about the bug! Darin actually warned me about uninitialized variable
warnings in another part of that patch, but I didn't know that I have to test a
deployment build.

These initial values are never used: firstSmallCap is only used when isSmallCap
is true, and whenever isSmallCap is set to true, firstSmallCap is set;
substituteRenderer is only used if substituteLength > 0, in which case
substituteRenderer is set.
Comment 2 Darin Adler 2005-12-20 09:10:00 PST
Comment on attachment 5169 [details]
Build fix

r=me
Comment 3 mitz 2005-12-20 13:15:11 PST
Created attachment 5189 [details]
fix more uninitialized variable warnings

These are the ones Darin warned me about. Why do they generate warnings only in
deployment configuration?
Comment 4 Justin Garcia 2005-12-20 13:36:38 PST
Apparently gcc warns about uninitialized variables when any sort of optimizations are turned on.  Tim H. 
is looking into a way to turn these warnings on in Development mode w/o enabling optimizations.
Comment 5 Geoffrey Garen 2005-12-20 13:45:06 PST
Comment on attachment 5189 [details]
fix more uninitialized variable warnings

r=me