Bug 75447

Summary: Ambiguous if-then-else in Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm
Product: WebKit Reporter: Bill Wendling <isanbard>
Component: WebKit Misc.Assignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, ap, enrica, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch bweinstein: review+

Bill Wendling
Reported 2012-01-02 14:21:22 PST
Clang discovered an ambiguous if-then-else in Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm. Here's the code (around line 254): if (archive) if ([types containsObject:WebArchivePboardType]) [self setData:[archive data] forType:WebArchivePboardType]; else { // We should not have declared types that we aren't going to write (4031826). ASSERT(![types containsObject:NSRTFDPboardType]); ASSERT(![types containsObject:WebArchivePboardType]); } Clang suggests adding explicit braces. Indeed, the indenting suggests that the code should be different from what it is.
Attachments
Patch (1.91 KB, patch)
2012-01-04 13:59 PST, Anders Carlsson
bweinstein: review+
Alexey Proskuryakov
Comment 1 2012-01-03 11:06:43 PST
This was introduced in <http://trac.webkit.org/changeset/21533>. No release build impact though, as it's only assertions. How did clang discover this? Did you use static analyzer, or different warnings flags with a regular build?
Bill Wendling
Comment 2 2012-01-03 13:00:44 PST
I was using ToT clang and doing a normal build. I believe it's a new warning flag that's on by default.
Anders Carlsson
Comment 3 2012-01-04 13:59:44 PST
Anders Carlsson
Comment 4 2012-01-04 14:03:03 PST
Note You need to log in before you can comment on or make changes to this bug.