Bug 24099

Summary: ARM Compiler Warnings in pcre_exec.cpp
Product: WebKit Reporter: Carol Szabo <carol>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: carol, ddkilzer, hausmann, laszlo.gombos
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Other   
Attachments:
Description Flags
Proposed fix. darin: review+

Description Carol Szabo 2009-02-23 11:35:00 PST
When compiling pcre_exec.cpp the ARM Compiler issues the following warnings:
"../JavaScriptCore/pcre/pcre_exec.cpp", line 1823: Warning:  #546-D: transfer of control bypasses initialization of:
            variable "othercase" (declared at line 1189)
          case 28: goto RRETURN_28;
                   ^
"../JavaScriptCore/pcre/pcre_exec.cpp", line 1824: Warning:  #546-D: transfer of control bypasses initialization of:
            variable "othercase" (declared at line 1189)
          case 29: goto RRETURN_29;
This is due to the fact that the variable "othercase" declared, defined and initialized in line 1189 goes out of scope 
and back in scope for non GCC compilers, that is when USE_COMPUTED_GOTO_FOR_MATCH_RECURSION is not defined.
In this case execution branches out from line 1203 during expansion of the RECURSIVE_MATCH MACRO to line 1823 where othercase is
out of scope un then execution is resumed at line 1204 when the variable is in scope but not initialized.
Most recent compilers do not pick this up as an error (like GCC does when used with relevant flags), but the practice of by-passing
declaration of local variables via goto or case statements is not very portable and is confusing. 
These warnings and potential gcc errors can be easily eliminated by moving the declaration of 
"othercase" to function scope, which has no adverse effects.
Patch will follow.
Comment 1 Carol Szabo 2009-02-23 11:45:50 PST
Created attachment 27886 [details]
Proposed fix.
Comment 2 Darin Adler 2009-02-24 13:32:08 PST
Comment on attachment 27886 [details]
Proposed fix.

Seems OK. r=me
Comment 3 Holger Freyther 2009-02-26 09:12:21 PST
Landed in r41252.