⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181669 in webkit


Ignore:
Timestamp:
Mar 17, 2015, 3:57:40 PM (11 years ago)
Author:
dino@apple.com
Message:

check-webkit-style should allow "bool a : 1"
https://bugs.webkit.org/show_bug.cgi?id=142794

Reviewed by Brent Fulgham.

We should allow member bitfields of the form:

bool m_var : 1;

It seems that Visual Studio 8 was the last compiler that
wasn't happy about not using unsigned here. We already have
about 500 cases (in WebCore) where people were ignoring this rule.

  • Scripts/webkitpy/style/checkers/cpp.py:

(check_language): Allow "bool".

  • Scripts/webkitpy/style/checkers/cpp_unittest.py: Add tests.

(CppStyleTest.test_enum_bitfields):
(CppStyleTest.test_plain_integral_bitfields):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r181663 r181669  
     12015-03-17  Dean Jackson  <dino@apple.com>
     2
     3        check-webkit-style should allow "bool a : 1"
     4        https://bugs.webkit.org/show_bug.cgi?id=142794
     5
     6        Reviewed by Brent Fulgham.
     7
     8        We should allow member bitfields of the form:
     9
     10        bool m_var : 1;
     11
     12        It seems that Visual Studio 8 was the last compiler that
     13        wasn't happy about not using unsigned here. We already have
     14        about 500 cases (in WebCore) where people were ignoring this rule.
     15
     16        * Scripts/webkitpy/style/checkers/cpp.py:
     17        (check_language): Allow "bool".
     18        * Scripts/webkitpy/style/checkers/cpp_unittest.py: Add tests.
     19        (CppStyleTest.test_enum_bitfields):
     20        (CppStyleTest.test_plain_integral_bitfields):
     21
    1222015-03-17  Benjamin Poulain  <bpoulain@apple.com>
    223
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r180981 r181669  
    32743274    if matched:
    32753275        # Make sure the type is an enum and not an integral type
    3276         if not match(r'char|(short(\s+int)?)|int|long(\s+(long|int))|(signed|unsigned)(\s+int)?', matched.group(3)):
     3276        if not match(r'bool|char|(short(\s+int)?)|int|long(\s+(long|int))|(signed|unsigned)(\s+int)?', matched.group(3)):
    32773277            error(line_number, 'runtime/enum_bitfields', 5,
    32783278                  'Please declare enum bitfields as unsigned integral types.')
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r180981 r181669  
    25532553        self.assert_lint('mutable AnEnum a : 14;', errmsg)
    25542554        self.assert_lint('const AnEnum a : 6;', errmsg)
     2555        self.assert_lint('bool a : 1;', '')
    25552556
    25562557    # Integral bitfields must be declared with either signed or unsigned keyword.
     
    25632564        self.assert_lint('long int a : 30;', errmsg)
    25642565        self.assert_lint('int a = 1 ? 0 : 30;', '')
    2565 
     2566        self.assert_lint('bool a : 1;', '')
    25662567
    25672568class CleansedLinesTest(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.