Skip to content

Commit 40f076f

Browse files
committed
chore: unify include guards to #pragma once
[no important files changed]
1 parent 0b9f7ee commit 40f076f

File tree

134 files changed

+134
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+134
-525
lines changed

bin/make-stub-files.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ for exercise_dir in "${exercises_dir}"/*; do
2121
header="$exercise_name.h"
2222
source="$exercise_name.cpp"
2323
if ! test -f "$header"; then
24-
printf "#if !defined(${exercise_name^^}_H)\n" >> $header
25-
printf "#define ${exercise_name^^}_H\n" >> $header
24+
printf "#pragma once\n" >> $header
2625
printf "\nnamespace $exercise_name {\n\n} // namespace $exercise_name\n" >> $header
27-
printf "\n#endif // ${exercise_name^^}_H" >> $header
2826
git add $header
2927
fi
3028
if ! test -f "$source"; then

concepts/headers/about.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ One possible layout is to keep all the implementation details in the source file
4949

5050
```cpp
5151
// A file named robot_flower.h
52-
#if !defined(ROBOT_FLOWER_H)
53-
#define ROBOT_FLOWER_H
52+
#pragma once
5453
#include <string>
5554
namespace robots {
5655
class Flower {

concepts/headers/introduction.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ One possible layout is to keep all the implementation details in the source file
4949

5050
```cpp
5151
// A file named robot_flower.h
52-
#if !defined(ROBOT_FLOWER_H)
53-
#define ROBOT_FLOWER_H
52+
#pragma once
5453
#include <string>
5554
namespace robots {
5655
class Flower {

exercises/concept/doctor-data/.docs/introduction.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ One possible layout is to keep all the implementation details in the source file
4949

5050
```cpp
5151
// A file named robot_flower.h
52-
#if !defined(ROBOT_FLOWER_H)
53-
#define ROBOT_FLOWER_H
52+
#pragma once
5453
#include <string>
5554
namespace robots {
5655
class Flower {
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if !defined(ACRONYM_H)
2-
#define ACRONYM_H
1+
#pragma once
32

43
#include <string>
54

@@ -8,5 +7,3 @@ namespace acronym {
87
std::string acronym(std::string const&);
98

109
}
11-
12-
#endif
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
#if !defined(ACRONYM_H)
2-
#define ACRONYM_H
1+
#pragma once
32

43
namespace acronym {
54

65
// TODO: add your solution here
76

87
} // namespace acronym
9-
10-
#endif // ACRONYM_H
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if !defined(ALL_YOUR_BASE_H)
2-
#define ALL_YOUR_BASE_H
1+
#pragma once
32

43
#include <vector>
54

@@ -9,5 +8,3 @@ std::vector<unsigned int> convert(unsigned int input_base,
98
const std::vector<unsigned int>& input_digits,
109
unsigned int output_base);
1110
}
12-
13-
#endif
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
#if !defined(ALL_YOUR_BASE_H)
2-
#define ALL_YOUR_BASE_H
1+
#pragma once
32

43
namespace all_your_base {
54

65
// TODO: add your solution here
76

87
} // namespace all_your_base
9-
10-
#endif // ALL_YOUR_BASE_H

exercises/practice/allergies/.meta/example.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if !defined(ALLERGIES_H)
2-
#define ALLERGIES_H
1+
#pragma once
32

43
#include <map>
54
#include <string>
@@ -23,5 +22,3 @@ class allergy_test {
2322
};
2423

2524
} // namespace allergies
26-
27-
#endif
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
#if !defined(ALLERGIES_H)
2-
#define ALLERGIES_H
1+
#pragma once
32

43
namespace allergies {
54

65
// TODO: add your solution here
76

87
} // namespace allergies
9-
10-
#endif // ALLERGIES_H

0 commit comments

Comments
 (0)