Skip to content

Commit b5bdb88

Browse files
authored
Merge pull request #102298 from Repiteo/style/pragma-once
Replace header guards style with `#pragma once`
2 parents 7459a03 + 1e22a19 commit b5bdb88

File tree

1,764 files changed

+1814
-7117
lines changed

Some content is hidden

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

1,764 files changed

+1814
-7117
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@ e06d83860d798b6766b23d6eae48557387a7db85
6969

7070
# Style: Enforce trailing newlines on svgs
7171
7e5baa042639ffa835271703c720e2595e90afb8
72+
73+
# Style: Replace header guards with `#pragma once`
74+
324512e11c1b7663c3cf47bec6ddbe65c6b8db2b

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ repos:
154154
language: python
155155
entry: python misc/scripts/header_guards.py
156156
files: \.(h|hpp|hh|hxx)$
157-
exclude: ^.*/(dummy|thread|platform_config|platform_gl)\.h$
158157

159158
- id: file-format
160159
name: file-format

core/config/engine.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef ENGINE_H
32-
#define ENGINE_H
31+
#pragma once
3332

3433
#include "core/os/main_loop.h"
3534
#include "core/string/ustring.h"
@@ -214,5 +213,3 @@ class Engine {
214213
Engine();
215214
virtual ~Engine();
216215
};
217-
218-
#endif // ENGINE_H

core/config/project_settings.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef PROJECT_SETTINGS_H
32-
#define PROJECT_SETTINGS_H
31+
#pragma once
3332

3433
#include "core/object/class_db.h"
3534

@@ -243,5 +242,3 @@ Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p
243242
#define GLOBAL_DEF_RST_NOVAL_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, true, true)
244243

245244
#define GLOBAL_DEF_INTERNAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, false, true)
246-
247-
#endif // PROJECT_SETTINGS_H

core/core_bind.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef CORE_BIND_H
32-
#define CORE_BIND_H
31+
#pragma once
3332

3433
#include "core/debugger/engine_profiler.h"
3534
#include "core/io/resource_loader.h"
@@ -670,5 +669,3 @@ VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyEndType);
670669
VARIANT_ENUM_CAST(core_bind::Thread::Priority);
671670

672671
VARIANT_ENUM_CAST(core_bind::special::ClassDB::APIType);
673-
674-
#endif // CORE_BIND_H

core/core_constants.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef CORE_CONSTANTS_H
32-
#define CORE_CONSTANTS_H
31+
#pragma once
3332

3433
#include "core/string/string_name.h"
3534
#include "core/templates/hash_map.h"
@@ -47,5 +46,3 @@ class CoreConstants {
4746
static bool is_global_enum(const StringName &p_enum);
4847
static void get_enum_values(const StringName &p_enum, HashMap<StringName, int64_t> *p_values);
4948
};
50-
51-
#endif // CORE_CONSTANTS_H

core/core_globals.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef CORE_GLOBALS_H
32-
#define CORE_GLOBALS_H
31+
#pragma once
3332

3433
// Home for state needed from global functions
3534
// that cannot be stored in Engine or OS due to e.g. circular includes
@@ -40,5 +39,3 @@ class CoreGlobals {
4039
static bool print_line_enabled;
4140
static bool print_error_enabled;
4241
};
43-
44-
#endif // CORE_GLOBALS_H

core/core_string_names.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef CORE_STRING_NAMES_H
32-
#define CORE_STRING_NAMES_H
31+
#pragma once
3332

3433
#include "core/string/string_name.h"
3534

@@ -87,5 +86,3 @@ class CoreStringNames {
8786
};
8887

8988
#define CoreStringName(m_name) CoreStringNames::get_singleton()->m_name
90-
91-
#endif // CORE_STRING_NAMES_H

core/crypto/aes_context.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef AES_CONTEXT_H
32-
#define AES_CONTEXT_H
31+
#pragma once
3332

3433
#include "core/crypto/crypto_core.h"
3534
#include "core/object/ref_counted.h"
@@ -64,5 +63,3 @@ class AESContext : public RefCounted {
6463
};
6564

6665
VARIANT_ENUM_CAST(AESContext::Mode);
67-
68-
#endif // AES_CONTEXT_H

core/crypto/crypto.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#ifndef CRYPTO_H
32-
#define CRYPTO_H
31+
#pragma once
3332

3433
#include "core/crypto/hashing_context.h"
3534
#include "core/io/resource.h"
@@ -167,5 +166,3 @@ class ResourceFormatSaverCrypto : public ResourceFormatSaver {
167166
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
168167
virtual bool recognize(const Ref<Resource> &p_resource) const override;
169168
};
170-
171-
#endif // CRYPTO_H

0 commit comments

Comments
 (0)