Changeset 87771 in webkit


Ignore:
Timestamp:
May 31, 2011, 7:40:27 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-31 Yong Li <yoli@rim.com>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=54807
We have been assuming plain bitfields (like "int a : 31") are always signed integers.
However some compilers can treat them as unsigned. For example, RVCT 4.0 states plain
bitfields (declared without either signed or unsigned qualifiers) are treats as unsigned.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0348c/Babjddhe.html
Although we can use "--signed-bitfields" flag to make RVCT 4.0 behave as most other compilers,
always using "signed"/"unsigned" qualifier to declare integral type bitfields is still a good
rule we should have in order to make our code independent from compilers and compiler flags.

No new test added because this change is not known to fix any issue.

  • bytecode/StructureStubInfo.h:

2011-05-31 Yong Li <yoli@rim.com>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=54807
We have been assuming plain bitfields (like "int a : 31") are always signed integers.
However some compilers can treat them as unsigned. For example, RVCT 4.0 states plain
bitfields (declared without either signed or unsigned qualifiers) are treats as unsigned.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0348c/Babjddhe.html
Although we can use "--signed-bitfields" flag to make RVCT 4.0 behave as most other compilers,
always using "signed"/"unsigned" qualifier to declare integral type bitfields is still a good
rule we should have in order to make our code independent from compilers and compiler flags.

No new test added because this change is not known to fix any issue.

  • css/CSSPrimitiveValue.h:
  • css/CSSProperty.h:
  • rendering/InlineBox.h:
  • rendering/RenderBlock.h:

2011-05-31 Yong Li <yoli@rim.com>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=54807
We have been assuming plain bitfields (like "int a : 31") are always signed integers.
However some compilers can treat them as unsigned. For example, RVCT 4.0 states plain
bitfields (declared without either signed or unsigned qualifiers) are treats as unsigned.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0348c/Babjddhe.html
Although we can use "--signed-bitfields" flag to make RVCT 4.0 behave as most other compilers,
always using "signed"/"unsigned" qualifier to declare integral type bitfields is still a good
rule we should have in order to make our code independent from compilers and compiler flags.

  • Scripts/webkitpy/style/checkers/cpp.py:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/JavaScriptCore/ChangeLog

    r87702 r87771  
     12011-05-31  Yong Li  <yoli@rim.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=54807
     6        We have been assuming plain bitfields (like "int a : 31") are always signed integers.
     7        However some compilers can treat them as unsigned. For example, RVCT 4.0 states plain
     8        bitfields (declared without either signed or unsigned qualifiers) are treats as unsigned.
     9        http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0348c/Babjddhe.html
     10        Although we can use "--signed-bitfields" flag to make RVCT 4.0 behave as most other compilers,
     11        always using "signed"/"unsigned" qualifier to declare integral type bitfields is still a good
     12        rule we should have in order to make our code independent from compilers and compiler flags.
     13
     14        No new test added because this change is not known to fix any issue.
     15
     16        * bytecode/StructureStubInfo.h:
     17
    1182011-05-30  Hojong Han  <hojong.han@samsung.com>
    219
  • TabularUnified trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h

    r87431 r87771  
    128128        }
    129129
    130         int accessType : 31;
    131         int seen : 1;
     130        signed accessType : 31;
     131        unsigned seen : 1;
    132132
    133133        union {
  • TabularUnified trunk/Source/WebCore/ChangeLog

    r87770 r87771  
     12011-05-31  Yong Li  <yoli@rim.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=54807
     6        We have been assuming plain bitfields (like "int a : 31") are always signed integers.
     7        However some compilers can treat them as unsigned. For example, RVCT 4.0 states plain
     8        bitfields (declared without either signed or unsigned qualifiers) are treats as unsigned.
     9        http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0348c/Babjddhe.html
     10        Although we can use "--signed-bitfields" flag to make RVCT 4.0 behave as most other compilers,
     11        always using "signed"/"unsigned" qualifier to declare integral type bitfields is still a good
     12        rule we should have in order to make our code independent from compilers and compiler flags.
     13
     14        No new test added because this change is not known to fix any issue.
     15
     16        * css/CSSPrimitiveValue.h:
     17        * css/CSSProperty.h:
     18        * rendering/InlineBox.h:
     19        * rendering/RenderBlock.h:
     20
    1212011-05-31  Hironori Bono  <hbono@chromium.org>
    222
  • TabularUnified trunk/Source/WebCore/css/CSSPrimitiveValue.h

    r80463 r87771  
    226226    virtual unsigned short cssValueType() const;
    227227
    228     int m_type : 31;
     228    signed m_type : 31;
    229229    mutable unsigned m_hasCachedCSSText : 1;
    230230    union {
  • TabularUnified trunk/Source/WebCore/css/CSSProperty.h

    r76248 r87771  
    6767
    6868    // Make sure the following fits in 4 bytes. Really.
    69     int m_id : 15;
    70     int m_shorthandID : 15; // If this property was set as part of a shorthand, gives the shorthand.
     69    signed m_id : 15;
     70    signed m_shorthandID : 15; // If this property was set as part of a shorthand, gives the shorthand.
    7171    bool m_important : 1;
    7272    bool m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand.
  • TabularUnified trunk/Source/WebCore/rendering/InlineBox.h

    r87753 r87771  
    366366    mutable bool m_nextOnLineExists : 1;
    367367    mutable bool m_prevOnLineExists : 1;
    368     int m_expansion : 11; // for justified text
     368    signed m_expansion : 11; // for justified text
    369369
    370370#ifndef NDEBUG
  • TabularUnified trunk/Source/WebCore/rendering/RenderBlock.h

    r87302 r87771  
    829829    RenderLineBoxList m_lineBoxes;   // All of the root line boxes created for this block flow.  For example, <div>Hello<br>world.</div> will have two total lines for the <div>.
    830830
    831     mutable int m_lineHeight : 31;
     831    mutable signed m_lineHeight : 31;
    832832    bool m_beingDestroyed : 1;
    833833
  • TabularUnified trunk/Tools/ChangeLog

    r87770 r87771  
     12011-05-31  Yong Li  <yoli@rim.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=54807
     6        We have been assuming plain bitfields (like "int a : 31") are always signed integers.
     7        However some compilers can treat them as unsigned. For example, RVCT 4.0 states plain
     8        bitfields (declared without either signed or unsigned qualifiers) are treats as unsigned.
     9        http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0348c/Babjddhe.html
     10        Although we can use "--signed-bitfields" flag to make RVCT 4.0 behave as most other compilers,
     11        always using "signed"/"unsigned" qualifier to declare integral type bitfields is still a good
     12        rule we should have in order to make our code independent from compilers and compiler flags.
     13
     14        * Scripts/webkitpy/style/checkers/cpp.py:
     15
    1162011-05-31  Hironori Bono  <hbono@chromium.org>
    217
  • TabularUnified trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r85138 r87771  
    29202920              ' for more information.')
    29212921
     2922    # Check for plain bitfields declared without either "singed" or "unsigned".
     2923    # Most compilers treat such bitfields as signed, but there are still compilers like
     2924    # RVCT 4.0 that use unsigned by default.
     2925    matched = re.match(r'\s*((const|mutable)\s+)?(char|(short(\s+int)?)|int|long(\s+(long|int))?)\s+.+\s*:\s*\d+\s*;', line)
     2926    if matched:
     2927        error(line_number, 'runtime/bitfields', 5,
     2928              'Please declare integral type bitfields with either signed or unsigned.')
     2929
    29222930    check_identifier_name_in_declaration(filename, line_number, line, file_state, error)
    29232931
     
    34533461        'readability/webkit_api',
    34543462        'runtime/arrays',
     3463        'runtime/bitfields',
    34553464        'runtime/casting',
    34563465        'runtime/explicit',
  • TabularUnified trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r85138 r87771  
    23742374                         'operator*).  [runtime/invalid_increment] [5]')
    23752375
     2376    # Integral bitfields must be declared with either signed or unsigned keyword.
     2377    def test_plain_integral_bitfields(self):
     2378        errmsg = ('Please declare integral type bitfields with either signed or unsigned.  [runtime/bitfields] [5]')
     2379
     2380        self.assert_lint('int a : 30;', errmsg)
     2381        self.assert_lint('mutable short a : 14;', errmsg)
     2382        self.assert_lint('const char a : 6;', errmsg)
     2383        self.assert_lint('long int a : 30;', errmsg)
    23762384
    23772385class CleansedLinesTest(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.