From c452feaec976a996dc0119873c8f203c945c389d Mon Sep 17 00:00:00 2001 From: "erg@chromium.org" Date: Thu, 26 Jan 2012 21:10:45 +0000 Subject: [PATCH] Update cpplint.py to r78. Review URL: http://codereview.chromium.org/9113091 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@119290 0039d316-1c4b-4281-b951-d872f2087c98 --- cpplint.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cpplint.py b/cpplint.py index 016116b5b..c985c5dc5 100755 --- a/cpplint.py +++ b/cpplint.py @@ -1071,12 +1071,18 @@ def CheckForHeaderGuard(filename, lines, error): endif = line endif_linenum = linenum - if not ifndef or not define or ifndef != define: + if not ifndef: error(filename, 0, 'build/header_guard', 5, 'No #ifndef header guard found, suggested CPP variable is: %s' % cppvar) return + if not define: + error(filename, 0, 'build/header_guard', 5, + 'No #define header guard found, suggested CPP variable is: %s' % + cppvar) + return + # The guard should be PATH_FILE_H_, but we also allow PATH_FILE_H__ # for backward compatibility. if ifndef != cppvar: @@ -1089,6 +1095,12 @@ def CheckForHeaderGuard(filename, lines, error): error(filename, ifndef_linenum, 'build/header_guard', error_level, '#ifndef header guard has wrong style, please use: %s' % cppvar) + if define != ifndef: + error(filename, 0, 'build/header_guard', 5, + '#ifndef and #define don\'t match, suggested CPP variable is: %s' % + cppvar) + return + if endif != ('#endif // %s' % cppvar): error_level = 0 if endif != ('#endif // %s' % (cppvar + '_')):