Bug 6153

Summary: build failure after WebTextRenderer patch, uninitialized variables
Product: WebKit Reporter: Justin Garcia <justin.garcia>
Component: Tools / TestsAssignee: mitz
Severity: Normal    
Priority: P1    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Description Flags
Build fix
darin: review+
fix more uninitialized variable warnings ggaren: review+

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 
/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;
                    ATSUSetRunStyle(layout, getSmallCapsRenderer(r)->_ATSUStyle, firstSmallCap, i - 

 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

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