Improve the check for header guard
Summary: cpplint.py only recognize `#ifdef HEADER_GUARD` as header guard. This patch enables the check for `#pragma once`. Test Plan: New arc lint exclude the false alarm for `#pragma once`. Reviewers: dhruba, sdong, igor, haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D16227
This commit is contained in:
parent
78ce24a709
commit
83e7842f80
3
linters/cpp_linter/cpplint.py
vendored
3
linters/cpp_linter/cpplint.py
vendored
@ -1420,6 +1420,9 @@ def CheckForHeaderGuard(filename, lines, error):
|
||||
endif = None
|
||||
endif_linenum = 0
|
||||
for linenum, line in enumerate(lines):
|
||||
# Already been well guarded, no need for further checking.
|
||||
if line.strip() == "#pragma once":
|
||||
return
|
||||
linesplit = line.split()
|
||||
if len(linesplit) >= 2:
|
||||
# find the first occurrence of #ifndef and #define, save arg
|
||||
|
Loading…
Reference in New Issue
Block a user