[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

levin at chromium.org levin at chromium.org
Thu Apr 8 00:54:41 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 3713717ba513f13069526edad3fd740ca9c9e17b
Author: levin at chromium.org <levin at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 5 18:43:36 2010 +0000

    Having a comment for the #endif for a header guard is not required WebKit style.
    https://bugs.webkit.org/show_bug.cgi?id=33214
    
    Reviewed by Darin Adler.
    
    * Scripts/webkitpy/cpp_style.py: removed the check and made the loop exit
      early when it has all the needed information to continue.
    * Scripts/webkitpy/cpp_style_unittest.py: removed the corresponding tests.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52808 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index e9c88d2..6c22b81 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-05  David Levin  <levin at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Having a comment for the #endif for a header guard is not required WebKit style.
+        https://bugs.webkit.org/show_bug.cgi?id=33214
+
+        * Scripts/webkitpy/cpp_style.py: removed the check and made the loop exit
+          early when it has all the needed information to continue.
+        * Scripts/webkitpy/cpp_style_unittest.py: removed the corresponding tests.
+
 2010-01-05  Adam Roben  <aroben at apple.com>
 
         Share more code in the WebViewDestruction tests
diff --git a/WebKitTools/Scripts/webkitpy/cpp_style.py b/WebKitTools/Scripts/webkitpy/cpp_style.py
index 05c592e..2d95d3e 100644
--- a/WebKitTools/Scripts/webkitpy/cpp_style.py
+++ b/WebKitTools/Scripts/webkitpy/cpp_style.py
@@ -787,8 +787,6 @@ def check_for_header_guard(filename, lines, error):
     ifndef = None
     ifndef_line_number = 0
     define = None
-    endif = None
-    endif_line_number = 0
     for line_number, line in enumerate(lines):
         line_split = line.split()
         if len(line_split) >= 2:
@@ -799,10 +797,8 @@ def check_for_header_guard(filename, lines, error):
                 ifndef_line_number = line_number
             if not define and line_split[0] == '#define':
                 define = line_split[1]
-        # find the last occurrence of #endif, save entire line
-        if line.startswith('#endif'):
-            endif = line
-            endif_line_number = line_number
+            if define and ifndef:
+                break
 
     if not ifndef or not define or ifndef != define:
         error(filename, 0, 'build/header_guard', 5,
@@ -815,10 +811,6 @@ def check_for_header_guard(filename, lines, error):
         error(filename, ifndef_line_number, 'build/header_guard', 5,
               '#ifndef header guard has wrong style, please use: %s' % cppvar)
 
-    if endif != ('#endif // %s' % cppvar):
-        error(filename, endif_line_number, 'build/header_guard', 5,
-              '#endif line should be "#endif // %s"' % cppvar)
-
 
 def check_for_unicode_replacement_characters(filename, lines, error):
     """Logs an error for each line containing Unicode replacement characters.
diff --git a/WebKitTools/Scripts/webkitpy/cpp_style_unittest.py b/WebKitTools/Scripts/webkitpy/cpp_style_unittest.py
index d567a47..0effb75 100644
--- a/WebKitTools/Scripts/webkitpy/cpp_style_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/cpp_style_unittest.py
@@ -1714,47 +1714,6 @@ class CppStyleTest(CppStyleTestBase):
                 '  [build/header_guard] [5]' % expected_guard),
             error_collector.result_list())
 
-        # No endif
-        error_collector = ErrorCollector(self.assert_)
-        cpp_style.process_file_data(file_path, 'h',
-                                    ['#ifndef %s' % expected_guard,
-                                     '#define %s' % expected_guard],
-                                    error_collector)
-        self.assertEquals(
-            1,
-            error_collector.result_list().count(
-                '#endif line should be "#endif // %s"'
-                '  [build/header_guard] [5]' % expected_guard),
-            error_collector.result_list())
-
-        # Commentless endif
-        error_collector = ErrorCollector(self.assert_)
-        cpp_style.process_file_data(file_path, 'h',
-                                    ['#ifndef %s' % expected_guard,
-                                     '#define %s' % expected_guard,
-                                     '#endif'],
-                                    error_collector)
-        self.assertEquals(
-            1,
-            error_collector.result_list().count(
-                '#endif line should be "#endif // %s"'
-                '  [build/header_guard] [5]' % expected_guard),
-            error_collector.result_list())
-
-        # Commentless endif for old-style guard
-        error_collector = ErrorCollector(self.assert_)
-        cpp_style.process_file_data(file_path, 'h',
-                                    ['#ifndef %s_' % expected_guard,
-                                     '#define %s_' % expected_guard,
-                                     '#endif'],
-                                    error_collector)
-        self.assertEquals(
-            1,
-            error_collector.result_list().count(
-                '#endif line should be "#endif // %s"'
-                '  [build/header_guard] [5]' % expected_guard),
-            error_collector.result_list())
-
         # No header guard errors
         error_collector = ErrorCollector(self.assert_)
         cpp_style.process_file_data(file_path, 'h',
@@ -1779,12 +1738,6 @@ class CppStyleTest(CppStyleTestBase):
                 '#ifndef header guard has wrong style, please use: %s'
                 '  [build/header_guard] [5]' % expected_guard),
             error_collector.result_list())
-        self.assertEquals(
-            1,
-            error_collector.result_list().count(
-                '#endif line should be "#endif // %s"'
-                '  [build/header_guard] [5]' % expected_guard),
-            error_collector.result_list())
 
     def test_build_printf_format(self):
         self.assert_lint(

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list