From 683dfbf9462dc6ae6b74a02589965e700ce3c252 Mon Sep 17 00:00:00 2001 From: zhangchen909 <906296354@qq.com> Date: Thu, 5 May 2022 17:12:33 +0800 Subject: [PATCH] support file check success which encoding with bom. --- cpplint/cpplint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index 4a82bde4f..7c751eea1 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -1916,11 +1916,11 @@ def CheckForHeaderGuard(filename, clean_lines, error): linesplit = line.split() if len(linesplit) >= 2: # find the first occurrence of #ifndef and #define, save arg - if not ifndef and linesplit[0] == '#ifndef': + if not ifndef and (linesplit[0] == '#ifndef' or linesplit[0] == '\ufeff#ifndef'): # set ifndef to the header guard presented on the #ifndef line. ifndef = linesplit[1] ifndef_linenum = linenum - if not define and linesplit[0] == '#define': + if not define and (linesplit[0] == '#define' or linesplit[0] == '\ufeff#define'): define = linesplit[1] # find the last occurrence of #endif, save entire line if line.startswith('#endif'):