clang-tidy module: add test for #pragma once check
This commit is contained in:
parent
c9af6f2ff6
commit
aa0c99c55c
@ -14,3 +14,4 @@ add_run_clang_tidy_test(cmake-use-cmstrlen)
|
||||
add_run_clang_tidy_test(cmake-use-cmsys-fstream)
|
||||
add_run_clang_tidy_test(cmake-use-bespoke-enum-class)
|
||||
add_run_clang_tidy_test(cmake-ostringstream-use-cmstrcat)
|
||||
add_run_clang_tidy_test(cmake-use-pragma-once)
|
||||
|
@ -0,0 +1,25 @@
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-both.h:1:1: warning: use #pragma once [cmake-use-pragma-once]
|
||||
#ifndef BOTH_H
|
||||
^~~~~~~~~~~~~~
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-both.h:1:1: note: FIX-IT applied suggested code changes
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-both.h:2:1: note: FIX-IT applied suggested code changes
|
||||
#define BOTH_H
|
||||
^
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-both.h:10:1: note: FIX-IT applied suggested code changes
|
||||
#endif
|
||||
^
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:1:1: warning: use #pragma once [cmake-use-pragma-once]
|
||||
#ifndef INCLUDE_GUARDS_H
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#pragma once
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:1:1: note: FIX-IT applied suggested code changes
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:2:1: note: FIX-IT applied suggested code changes
|
||||
#define INCLUDE_GUARDS_H
|
||||
^
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:9:1: note: FIX-IT applied suggested code changes
|
||||
#endif
|
||||
^
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-neither.h:1:1: warning: use #pragma once [cmake-use-pragma-once]
|
||||
int neither()
|
||||
^
|
||||
cmake-use-pragma-once/cmake-use-pragma-once-neither.h:1:1: note: FIX-IT applied suggested code changes
|
@ -0,0 +1,5 @@
|
||||
#include "cmake-use-pragma-once/cmake-use-pragma-once.h"
|
||||
|
||||
#include "cmake-use-pragma-once/cmake-use-pragma-once-both.h"
|
||||
#include "cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h"
|
||||
#include "cmake-use-pragma-once/cmake-use-pragma-once-neither.h"
|
@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
int both()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
#ifndef BOTH_H
|
||||
#define BOTH_H
|
||||
#pragma once
|
||||
|
||||
int both()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
int includeGuards()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#ifndef INCLUDE_GUARDS_H
|
||||
#define INCLUDE_GUARDS_H
|
||||
|
||||
int includeGuards()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
int neither()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
int neither()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
int once()
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user