File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class AvoidPragmaOnceCheck : public ClangTidyCheck {
2424 AvoidPragmaOnceCheck (StringRef Name, ClangTidyContext *Context)
2525 : ClangTidyCheck(Name, Context) {}
2626 bool isLanguageVersionSupported (const LangOptions &LangOpts) const override {
27- return LangOpts.CPlusPlus ;
27+ return LangOpts.CPlusPlus || LangOpts. C99 ;
2828 }
2929
3030 void registerPPCallbacks (const SourceManager &SM, Preprocessor *PP,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ some environments.
1313Some older or specialized C/C++ compilers, particularly in embedded systems,
1414may not fully support ``#pragma once ``.
1515
16- Also it can fail in certain file system configurations,like network drives
16+ It can also fail in certain file system configurations,like network drives
1717or complex symbolic links, potentially leading to compilation issues.
1818
1919Consider the following header file:
@@ -22,3 +22,14 @@ Consider the following header file:
2222
2323 // my_header.h
2424 #pragma once // warning: avoid 'pragma once' directive; use include guards instead
25+
26+
27+ The warning suggests using include guards:
28+
29+ .. code :: c++
30+
31+ // my_header.h
32+ #ifndef PATH_TO_MY_HEADER_H
33+ #define PATH_TO_MY_HEADER_H
34+
35+ #endif // PATH_TO_MY_HEADER_H
You can’t perform that action at this time.
0 commit comments