From 271cae0153382026739df5c0f23b5cd97b4907bc Mon Sep 17 00:00:00 2001 From: "yuehua.jia" <3423893+jiayuehua@users.noreply.github.com> Date: Sat, 29 Jan 2022 15:14:07 +0800 Subject: [PATCH] pragma once not allowd (#3842) Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> --- .linters/cpp/cpplint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.linters/cpp/cpplint.py b/.linters/cpp/cpplint.py index 2d53e233bbb..5cc9b348eb4 100755 --- a/.linters/cpp/cpplint.py +++ b/.linters/cpp/cpplint.py @@ -2130,9 +2130,11 @@ def CheckForHeaderGuard(filename, clean_lines, error): if Search(r'//\s*NOLINT\(build/header_guard\)', i): return - # Allow pragma once instead of header guards + # notallow pragma once for i in raw_lines: if Search(r'^\s*#pragma\s+once', i): + error(filename, 0, 'build/header_guard', 5, + 'Pragma once not allowed, please use ifndef Instead') return cppvar = GetHeaderGuardCPPVariable(filename)