Modified: trunk/Tools/ChangeLog (255552 => 255553)
--- trunk/Tools/ChangeLog 2020-02-02 23:18:47 UTC (rev 255552)
+++ trunk/Tools/ChangeLog 2020-02-03 04:26:55 UTC (rev 255553)
@@ -1,3 +1,16 @@
+2020-02-02 Sam Weinig <[email protected]>
+
+ Update style checker with new locations OS version checks are allowed
+ https://bugs.webkit.org/show_bug.cgi?id=207106
+
+ Reviewed by Alexey Proskuryakov.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_os_version_checks):
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (WebKitStyleTest.test_os_version_checks):
+ Update path check to allow anything with the pattern "Source/WTF/wtf/Platform[a-zA-Z]+\.h"
+
2020-02-01 Simon Fraser <[email protected]>
Closing a MiniBrowser WK2 window does not release the WKWebView
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (255552 => 255553)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2020-02-02 23:18:47 UTC (rev 255552)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2020-02-03 04:26:55 UTC (rev 255553)
@@ -1154,13 +1154,16 @@
_RE_PATTERN_XCODE_MIN_REQUIRED_MACRO = re.compile(
r'.+?([A-Z_]+)_VERSION_MIN_REQUIRED [><=]+ (\d+)')
+_RE_PATTERN_PLATFORM_HEADER = re.compile(
+ r'Source/WTF/wtf/Platform[a-zA-Z]+\.h')
+
def check_os_version_checks(filename, clean_lines, line_number, error):
""" Checks for mistakes using VERSION_MIN_REQUIRED and VERSION_MAX_ALLOWED macros:
1. These should only be used centrally to defined named HAVE, USE or ENABLE style macros.
2. VERSION_MIN_REQUIRED never changes for a minor OS version.
- These should be centralized in wtf/Platform.h and wtf/FeatureDefines.h.
+ These should be centralized in the wtf/Platform*.h suite of files.
Args:
filename: Name of the file that is being processed.
@@ -1178,11 +1181,11 @@
error(line_number, 'build/version_check', 5, 'Incorrect OS version check. VERSION_MIN_REQUIRED values never include a minor version. You may be looking for a combination of VERSION_MIN_REQUIRED for target OS version check and VERSION_MAX_ALLOWED for SDK check.')
break
- if filename == 'Source/WTF/wtf/Platform.h' or filename == 'Source/WTF/wtf/FeatureDefines.h':
+ if _RE_PATTERN_PLATFORM_HEADER.match(filename):
return
if _RE_PATTERN_XCODE_VERSION_MACRO.match(line):
- error(line_number, 'build/version_check', 5, 'Misplaced OS version check. Please use a named macro in wtf/Platform.h, wtf/FeatureDefines.h, or an appropriate internal file.')
+ error(line_number, 'build/version_check', 5, 'Misplaced OS version check. Please use a named macro in one of headers in the wtf/Platform.h suite of files or an appropriate internal file.')
class _ClassInfo(object):
"""Stores information about a class."""
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (255552 => 255553)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2020-02-02 23:18:47 UTC (rev 255552)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2020-02-03 04:26:55 UTC (rev 255553)
@@ -5869,14 +5869,14 @@
self.assert_lint('WK_API_AVAILABLE(ios(WK_MAC_TBA))', 'ios(WK_MAC_TBA) is invalid; expected WK_IOS_TBA or a number [build/wk_api_available] [5]')
def test_os_version_checks(self):
- self.assert_lint('#if PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000', 'Misplaced OS version check. Please use a named macro in wtf/Platform.h, wtf/FeatureDefines.h, or an appropriate internal file. [build/version_check] [5]')
- self.assert_lint('#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300', 'Misplaced OS version check. Please use a named macro in wtf/Platform.h, wtf/FeatureDefines.h, or an appropriate internal file. [build/version_check] [5]')
- self.assert_lint('#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300', '', 'Source/WTF/wtf/Platform.h')
- self.assert_lint('#if PLATFORM(MAC) && __IPHONE_OS_VERSION_MIN_REQUIRED > 120000', '', 'Source/WTF/wtf/Platform.h')
- self.assert_lint('#if PLATFORM(MAC) && __IPHONE_OS_VERSION_MIN_REQUIRED > 120400', 'Incorrect OS version check. VERSION_MIN_REQUIRED values never include a minor version. You may be looking for a combination of VERSION_MIN_REQUIRED for target OS version check and VERSION_MAX_ALLOWED for SDK check. [build/version_check] [5]', 'Source/WTF/wtf/Platform.h')
- self.assert_lint('#if !TARGET_OS_SIMULATOR && __WATCH_OS_VERSION_MIN_REQUIRED < 50000', 'Misplaced OS version check. Please use a named macro in wtf/Platform.h, wtf/FeatureDefines.h, or an appropriate internal file. [build/version_check] [5]')
- self.assert_lint('#if (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101304)', ['Incorrect OS version check. VERSION_MIN_REQUIRED values never include a minor version. You may be looking for a combination of VERSION_MIN_REQUIRED for target OS version check and VERSION_MAX_ALLOWED for SDK check. [build/version_check] [5]', 'Misplaced OS version check. Please use a named macro in wtf/Platform.h, wtf/FeatureDefines.h, or an appropriate internal file. [build/version_check] [5]'])
- self.assert_lint('#define FOO ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101302 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300))', 'Misplaced OS version check. Please use a named macro in wtf/Platform.h, wtf/FeatureDefines.h, or an appropriate internal file. [build/version_check] [5]')
+ self.assert_lint('#if PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000', 'Misplaced OS version check. Please use a named macro in one of headers in the wtf/Platform.h suite of files or an appropriate internal file. [build/version_check] [5]')
+ self.assert_lint('#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300', 'Misplaced OS version check. Please use a named macro in one of headers in the wtf/Platform.h suite of files or an appropriate internal file. [build/version_check] [5]')
+ self.assert_lint('#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300', '', 'Source/WTF/wtf/PlatformEnableCocoa.h')
+ self.assert_lint('#if PLATFORM(MAC) && __IPHONE_OS_VERSION_MIN_REQUIRED > 120000', '', 'Source/WTF/wtf/PlatformHave.h')
+ self.assert_lint('#if PLATFORM(MAC) && __IPHONE_OS_VERSION_MIN_REQUIRED > 120400', 'Incorrect OS version check. VERSION_MIN_REQUIRED values never include a minor version. You may be looking for a combination of VERSION_MIN_REQUIRED for target OS version check and VERSION_MAX_ALLOWED for SDK check. [build/version_check] [5]', 'Source/WTF/wtf/PlatformEnableCocoa.h')
+ self.assert_lint('#if !TARGET_OS_SIMULATOR && __WATCH_OS_VERSION_MIN_REQUIRED < 50000', 'Misplaced OS version check. Please use a named macro in one of headers in the wtf/Platform.h suite of files or an appropriate internal file. [build/version_check] [5]')
+ self.assert_lint('#if (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101304)', ['Incorrect OS version check. VERSION_MIN_REQUIRED values never include a minor version. You may be looking for a combination of VERSION_MIN_REQUIRED for target OS version check and VERSION_MAX_ALLOWED for SDK check. [build/version_check] [5]', 'Misplaced OS version check. Please use a named macro in one of headers in the wtf/Platform.h suite of files or an appropriate internal file. [build/version_check] [5]'])
+ self.assert_lint('#define FOO ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101302 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300))', 'Misplaced OS version check. Please use a named macro in one of headers in the wtf/Platform.h suite of files or an appropriate internal file. [build/version_check] [5]')
def test_other(self):
# FIXME: Implement this.