diff options
author | Alexander Galazin <alexander.galazin@arm.com> | 2021-06-18 10:17:32 +0200 |
---|---|---|
committer | Matthew Netsch <quic_mnetsch@quicinc.com> | 2021-10-01 18:20:17 +0000 |
commit | 138e75d6a383a39e2cd10f07f22153519a2f035d (patch) | |
tree | cf3faf867c92663ae8789784e53ef83464404207 /scripts | |
parent | ef46eaf4013b8058ba5ad783621325f430150564 (diff) | |
download | VK-GL-CTS-138e75d6a383a39e2cd10f07f22153519a2f035d.tar.gz VK-GL-CTS-138e75d6a383a39e2cd10f07f22153519a2f035d.tar.bz2 VK-GL-CTS-138e75d6a383a39e2cd10f07f22153519a2f035d.zip |
Allow the use of the standard types
Removes the script that enforces the use of
the de-wrappers instead of the standard types.
VK-GL-CTS issue: 2963
Components: Framework
Change-Id: I5e2ff38a2b2cbc63a3c756a1e0260833ecd9381e
(cherry picked from commit ce1ae17c4785a8a57214a16fac46e28832956fa9)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/src_util/check_all.py | 2 | ||||
-rw-r--r-- | scripts/src_util/check_invalid_literals.py | 111 |
2 files changed, 0 insertions, 113 deletions
diff --git a/scripts/src_util/check_all.py b/scripts/src_util/check_all.py index d2987fe87..b58e53149 100644 --- a/scripts/src_util/check_all.py +++ b/scripts/src_util/check_all.py @@ -28,7 +28,6 @@ from check_encoding import checkEncoding from check_whitespace import checkWhitespace from check_license import checkLicense from check_boms import checkBOMs -from check_invalid_literals import checkInvalidLiterals if __name__ == "__main__": parser = ArgumentParser() @@ -52,7 +51,6 @@ if __name__ == "__main__": checkWhitespace(files), checkIncludeGuards(files), checkLicense(files), - checkInvalidLiterals(files), #todo checkRedundantIncludeGuards(files), ]) diff --git a/scripts/src_util/check_invalid_literals.py b/scripts/src_util/check_invalid_literals.py deleted file mode 100644 index 8485c0898..000000000 --- a/scripts/src_util/check_invalid_literals.py +++ /dev/null @@ -1,111 +0,0 @@ -# -*- coding: utf-8 -*- - -#------------------------------------------------------------------------- -# drawElements Quality Program utilities -# -------------------------------------- -# -# Copyright (c) 2017 The Khronos Group Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#------------------------------------------------------------------------- - -import os -import re -import sys -from argparse import ArgumentParser -from common import getChangedFiles, getAllProjectFiles, isTextFile - -CHECK_LITERAL_PATTERNS = [ - r'\b[us]*int[0-9]+_t\b', - r'\b[U]*INT(_LEAST|_FAST|)[0-9]+_MAX\b', - r'\b0b', -] - -CHECK_LIST = [ - ".cpp", - ".hpp", - ".c", - ".h", -] - -EXCLUSION_LIST = [ - "framework/delibs/debase/deDefs.h", - "framework/platform/android/tcuAndroidPlatform.cpp", - "framework/platform/android/tcuAndroidWindow.hpp", - "framework/platform/android/tcuAndroidWindow.cpp", - "framework/platform/lnx/X11/tcuLnxX11Xcb.cpp", - "framework/platform/lnx/wayland/tcuLnxWayland.hpp", - "framework/platform/lnx/wayland/tcuLnxWayland.cpp", - "framework/delibs/debase/deFloat16.c", -] - -def checkEnds(line, ends): - return any(line.endswith(end) for end in ends) - -def checkFileInvalidLiterals (file): - error = False - - if checkEnds(file.replace("\\", "/"), CHECK_LIST) and not checkEnds(file.replace("\\", "/"), EXCLUSION_LIST): - f = open(file, 'rt') - for lineNum, line in enumerate(f): - # Remove inline comments - idx = line.find("//") - if idx > 0: - line = line[:idx] - # Remove text in quoted literals - if line.find("\"") > 0: - list = line.split('"') - del list[1::2] - line = ' ' - line = line.join(list) - for pattern in CHECK_LITERAL_PATTERNS: - found = re.search(pattern, line) - if found is not None: - error = True - print("%s:%i Unacceptable type found (pattern:%s)" % (file, lineNum+1, pattern)) - f.close() - - return not error - -def checkInvalidLiterals (files): - error = False - for file in files: - if isTextFile(file): - if not checkFileInvalidLiterals(file): - error = True - - return not error - -if __name__ == "__main__": - parser = ArgumentParser() - parser.add_argument("-e", "--only-errors", action="store_true", dest="onlyErrors", default=False, help="Print only on error") - parser.add_argument("-i", "--only-changed", action="store_true", dest="useGitIndex", default=False, help="Check only modified files. Uses git.") - - args = parser.parse_args() - - if args.useGitIndex: - files = getChangedFiles() - else: - files = getAllProjectFiles() - - # filter out original Vulkan header sources - files = [f for f in files if "vulkancts/scripts/src" not in f] - - error = not checkInvalidLiterals(files) - - if error: - print("One or more checks failed") - sys.exit(1) - if not args.onlyErrors: - print("All checks passed") |