From fd8a89af7505208a2917a9317e12e0bb618f3056 Mon Sep 17 00:00:00 2001 From: Choongwoo Han Date: Mon, 12 Dec 2022 14:59:19 -0800 Subject: [PATCH] [presubmit] Handle Windows path for header guard check AffectedFile.LocalPath returns a path with backward slashes in Windows. Update the presubmit script to handle this case properly. Bug: v8:13582 Change-Id: Iabc46ded5a8448e5d373679162108f94846c06e9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4099007 Reviewed-by: Michael Achenbach Commit-Queue: Choongwoo Han Cr-Commit-Position: refs/heads/main@{#84819} --- PRESUBMIT.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index ec4e9942e1..5c31d4dfab 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -261,8 +261,9 @@ def _CheckHeadersHaveIncludeGuards(input_api, output_api): files_to_check=(file_inclusion_pattern, ), files_to_skip=files_to_skip) - leading_src_pattern = input_api.re.compile(r'^src/') - dash_dot_slash_pattern = input_api.re.compile(r'[-./]') + leading_src_pattern = input_api.re.compile(r'^src[\\\/]') + dash_dot_slash_pattern = input_api.re.compile(r'[-.\\\/]') + def PathToGuardMacro(path): """Guards should be of the form V8_PATH_TO_FILE_WITHOUT_SRC_H_.""" x = input_api.re.sub(leading_src_pattern, 'v8_', path)