Modified: trunk/Tools/ChangeLog (185244 => 185245)
--- trunk/Tools/ChangeLog 2015-06-05 09:11:24 UTC (rev 185244)
+++ trunk/Tools/ChangeLog 2015-06-05 11:06:49 UTC (rev 185245)
@@ -1,3 +1,15 @@
+2015-06-04 Carlos Alberto Lopez Perez <clo...@igalia.com>
+
+ 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):
+
2015-06-05 Stephanie Lewis <sle...@apple.com>
Make the web server more robust to timing issues..
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (185244 => 185245)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2015-06-05 09:11:24 UTC (rev 185244)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2015-06-05 11:06:49 UTC (rev 185245)
@@ -2722,7 +2722,7 @@
if search(r'\bNULL\b', line):
# FIXME: We should recommend using nullptr instead of NULL in C++ code per
# <http://www.webkit.org/coding/coding-style.html#zero-null>.
- error(line_number, 'readability/null', 5, 'Use 0 instead of NULL.')
+ error(line_number, 'readability/null', 5, 'Use nullptr instead of NULL.')
return
line = clean_lines.raw_lines[line_number]
@@ -2730,9 +2730,7 @@
# matches, then do the check with strings collapsed to avoid giving errors for
# NULLs occurring in strings.
if search(r'\bNULL\b', line) and search(r'\bNULL\b', CleansedLines.collapse_strings(line)):
- # FIXME: We should recommend using nullptr instead of 0 or null in C++ code per
- # <http://www.webkit.org/coding/coding-style.html#zero-null>.
- error(line_number, 'readability/null', 4, 'Use 0 or null instead of NULL (even in *comments*).')
+ error(line_number, 'readability/null', 4, 'Use nullptr instead of NULL (even in *comments*).')
def get_line_width(line):
"""Determines the width of the line in column positions.
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (185244 => 185245)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2015-06-05 09:11:24 UTC (rev 185244)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2015-06-05 11:06:49 UTC (rev 185245)
@@ -4599,23 +4599,23 @@
'')
def test_null_false_zero(self):
- # 1. In C++, the null pointer value should be written as 0. In C,
+ # 1. In C++, the null pointer value should be written as nullptr. In C,
# it should be written as NULL. In Objective-C and Objective-C++,
# follow the guideline for C or C++, respectively, but use nil to
# represent a null Objective-C object.
self.assert_lint(
'functionCall(NULL)',
- 'Use 0 instead of NULL.'
+ 'Use nullptr instead of NULL.'
' [readability/null] [5]',
'foo.cpp')
self.assert_lint(
"// Don't use NULL in comments since it isn't in code.",
- 'Use 0 or null instead of NULL (even in *comments*).'
+ 'Use nullptr instead of NULL (even in *comments*).'
' [readability/null] [4]',
'foo.cpp')
self.assert_lint(
'"A string with NULL" // and a comment with NULL is tricky to flag correctly in cpp_style.',
- 'Use 0 or null instead of NULL (even in *comments*).'
+ 'Use nullptr instead of NULL (even in *comments*).'
' [readability/null] [4]',
'foo.cpp')
self.assert_lint(
@@ -4726,11 +4726,11 @@
'')
self.assert_lint(
'gtk_widget_style_get_property(style, NULL, NULL);',
- 'Use 0 instead of NULL. [readability/null] [5]',
+ 'Use nullptr instead of NULL. [readability/null] [5]',
'foo.cpp')
self.assert_lint(
'gtk_widget_style_get_valist(style, NULL, NULL);',
- 'Use 0 instead of NULL. [readability/null] [5]',
+ 'Use nullptr instead of NULL. [readability/null] [5]',
'foo.cpp')
# 2. C++ and C bool values should be written as true and
@@ -4791,10 +4791,10 @@
'')
self.assert_lint(
'if (LIKELY(foo == NULL))',
- 'Use 0 instead of NULL. [readability/null] [5]')
+ 'Use nullptr instead of NULL. [readability/null] [5]')
self.assert_lint(
'if (UNLIKELY(foo == NULL))',
- 'Use 0 instead of NULL. [readability/null] [5]')
+ 'Use nullptr instead of NULL. [readability/null] [5]')
def test_directive_indentation(self):
self.assert_lint(