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:
kailiu 2014-02-19 01:00:54 -08:00
parent 78ce24a709
commit 83e7842f80

View File

@ -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