Do not check include guards in PRESUBMIT for old IPC *_message_generator.h files
They use the include guards in a very specific, peculiar way Bug: 814776 Change-Id: I5ff8b8840f88ee993b42d7792be6267d3864f583 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1728533 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#682943}
This commit is contained in:

committed by
Commit Bot

parent
e53d3d6602
commit
0cdb3da737
@ -4077,8 +4077,11 @@ def _CheckForIncludeGuards(input_api, output_api):
|
||||
# We only check header files under the control of the Chromium
|
||||
# project. That is, those outside third_party apart from
|
||||
# third_party/blink.
|
||||
# We also exclude *_message_generator.h headers as they use
|
||||
# include guards in a special, non-typical way.
|
||||
file_with_path = input_api.os_path.normpath(f.LocalPath())
|
||||
return (file_with_path.endswith('.h') and
|
||||
not file_with_path.endswith('_message_generator.h') and
|
||||
(not file_with_path.startswith('third_party') or
|
||||
file_with_path.startswith(
|
||||
input_api.os_path.join('third_party', 'blink'))))
|
||||
|
@ -968,6 +968,15 @@ class IncludeGuardTest(unittest.TestCase):
|
||||
'struct SomeFileFoo;',
|
||||
'#endif // REQUIRED_RPCNDR_H_',
|
||||
]),
|
||||
# Not having proper include guard in *_message_generator.h
|
||||
# for old IPC messages is allowed.
|
||||
MockAffectedFile('content/common/content_message_generator.h', [
|
||||
'#undef CONTENT_COMMON_FOO_MESSAGES_H_',
|
||||
'#include "content/common/foo_messages.h"',
|
||||
'#ifndef CONTENT_COMMON_FOO_MESSAGES_H_',
|
||||
'#error "Failed to include content/common/foo_messages.h"',
|
||||
'#endif',
|
||||
]),
|
||||
]
|
||||
msgs = PRESUBMIT._CheckForIncludeGuards(
|
||||
mock_input_api, mock_output_api)
|
||||
|
Reference in New Issue
Block a user