Changeset 185245 in webkit


Ignore:
Timestamp:
Jun 5, 2015 4:06:49 AM (9 years ago)
Author:
clopez@igalia.com
Message:

check-webkit-style should recommend using nullptr instead of recommending using 0 for the null pointer in C++ code.
https://bugs.webkit.org/show_bug.cgi?id=145680

Reviewed by Brent Fulgham.

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

(check_for_null):

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

(WebKitStyleTest.test_null_false_zero):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r185244 r185245  
     12015-06-04  Carlos Alberto Lopez Perez  <clopez@igalia.com>
     2
     3        check-webkit-style should recommend using nullptr instead of recommending using 0 for the null pointer in C++ code.
     4        https://bugs.webkit.org/show_bug.cgi?id=145680
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * Scripts/webkitpy/style/checkers/cpp.py:
     9        (check_for_null):
     10        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
     11        (WebKitStyleTest.test_null_false_zero):
     12
    1132015-06-05  Stephanie Lewis  <slewis@apple.com>
    214
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r183567 r185245  
    27232723        # FIXME: We should recommend using nullptr instead of NULL in C++ code per
    27242724        # <http://www.webkit.org/coding/coding-style.html#zero-null>.
    2725         error(line_number, 'readability/null', 5, 'Use 0 instead of NULL.')
     2725        error(line_number, 'readability/null', 5, 'Use nullptr instead of NULL.')
    27262726        return
    27272727
     
    27312731    # NULLs occurring in strings.
    27322732    if search(r'\bNULL\b', line) and search(r'\bNULL\b', CleansedLines.collapse_strings(line)):
    2733         # FIXME: We should recommend using nullptr instead of 0 or null in C++ code per
    2734         # <http://www.webkit.org/coding/coding-style.html#zero-null>.
    2735         error(line_number, 'readability/null', 4, 'Use 0 or null instead of NULL (even in *comments*).')
     2733        error(line_number, 'readability/null', 4, 'Use nullptr instead of NULL (even in *comments*).')
    27362734
    27372735def get_line_width(line):
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r183567 r185245  
    46004600
    46014601    def test_null_false_zero(self):
    4602         # 1. In C++, the null pointer value should be written as 0. In C,
     4602        # 1. In C++, the null pointer value should be written as nullptr. In C,
    46034603        #    it should be written as NULL. In Objective-C and Objective-C++,
    46044604        #    follow the guideline for C or C++, respectively, but use nil to
     
    46064606        self.assert_lint(
    46074607            'functionCall(NULL)',
    4608             'Use 0 instead of NULL.'
     4608            'Use nullptr instead of NULL.'
    46094609            '  [readability/null] [5]',
    46104610            'foo.cpp')
    46114611        self.assert_lint(
    46124612            "// Don't use NULL in comments since it isn't in code.",
    4613             'Use 0 or null instead of NULL (even in *comments*).'
     4613            'Use nullptr instead of NULL (even in *comments*).'
    46144614            '  [readability/null] [4]',
    46154615            'foo.cpp')
    46164616        self.assert_lint(
    46174617            '"A string with NULL" // and a comment with NULL is tricky to flag correctly in cpp_style.',
    4618             'Use 0 or null instead of NULL (even in *comments*).'
     4618            'Use nullptr instead of NULL (even in *comments*).'
    46194619            '  [readability/null] [4]',
    46204620            'foo.cpp')
     
    47274727        self.assert_lint(
    47284728            'gtk_widget_style_get_property(style, NULL, NULL);',
    4729             'Use 0 instead of NULL.  [readability/null] [5]',
     4729            'Use nullptr instead of NULL.  [readability/null] [5]',
    47304730            'foo.cpp')
    47314731        self.assert_lint(
    47324732            'gtk_widget_style_get_valist(style, NULL, NULL);',
    4733             'Use 0 instead of NULL.  [readability/null] [5]',
     4733            'Use nullptr instead of NULL.  [readability/null] [5]',
    47344734            'foo.cpp')
    47354735
     
    47924792        self.assert_lint(
    47934793            'if (LIKELY(foo == NULL))',
    4794             'Use 0 instead of NULL.  [readability/null] [5]')
     4794            'Use nullptr instead of NULL.  [readability/null] [5]')
    47954795        self.assert_lint(
    47964796            'if (UNLIKELY(foo == NULL))',
    4797             'Use 0 instead of NULL.  [readability/null] [5]')
     4797            'Use nullptr instead of NULL.  [readability/null] [5]')
    47984798
    47994799    def test_directive_indentation(self):
Note: See TracChangeset for help on using the changeset viewer.