Bug 134252 - check-webkit-style should warn about signed values in bit fields
Summary: check-webkit-style should warn about signed values in bit fields
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-24 09:36 PDT by Brent Fulgham
Modified: 2014-06-24 22:41 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2014-06-24 09:36:06 PDT
MSVC backs its enumerated types as signed values. This causes problems when enums are used as elements in a bit field, because MSVC wants to include a sign bit in the encoding. This means we loose one bit of resolution, often causing incorrect behavior. See Bug 134237 for some details on this problem.

Because of this, 'check-webkit-style' should warn when a developer attempts to insert an enum or other potentially signed value in a bit field.

Should be rejected:
    SendCallbackPolicy sendLoadCallbacks : 1;
    ContentSniffingPolicy sniffContent : 1;
    DataBufferingPolicy dataBufferingPolicy : 1;

Should be allowed:
    unsigned sendLoadCallbacks : 1;
    bool sniffContent : 1;
    unsigned dataBufferingPolicy : 1;