Skip to content

Commit

Permalink
Merge pull request godotengine#102298 from Repiteo/style/pragma-once
Browse files Browse the repository at this point in the history
Replace header guards style with `#pragma once`
  • Loading branch information
Repiteo authored Mar 7, 2025
2 parents 7459a03 + 1e22a19 commit b5bdb88
Show file tree
Hide file tree
Showing 1,764 changed files with 1,814 additions and 7,117 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ e06d83860d798b6766b23d6eae48557387a7db85

# Style: Enforce trailing newlines on svgs
7e5baa042639ffa835271703c720e2595e90afb8

# Style: Replace header guards with `#pragma once`
324512e11c1b7663c3cf47bec6ddbe65c6b8db2b
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ repos:
language: python
entry: python misc/scripts/header_guards.py
files: \.(h|hpp|hh|hxx)$
exclude: ^.*/(dummy|thread|platform_config|platform_gl)\.h$

- id: file-format
name: file-format
Expand Down
5 changes: 1 addition & 4 deletions core/config/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef ENGINE_H
#define ENGINE_H
#pragma once

#include "core/os/main_loop.h"
#include "core/string/ustring.h"
Expand Down Expand Up @@ -214,5 +213,3 @@ class Engine {
Engine();
virtual ~Engine();
};

#endif // ENGINE_H
5 changes: 1 addition & 4 deletions core/config/project_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef PROJECT_SETTINGS_H
#define PROJECT_SETTINGS_H
#pragma once

#include "core/object/class_db.h"

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

#define GLOBAL_DEF_INTERNAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, false, true)

#endif // PROJECT_SETTINGS_H
5 changes: 1 addition & 4 deletions core/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef CORE_BIND_H
#define CORE_BIND_H
#pragma once

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

VARIANT_ENUM_CAST(core_bind::special::ClassDB::APIType);

#endif // CORE_BIND_H
5 changes: 1 addition & 4 deletions core/core_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef CORE_CONSTANTS_H
#define CORE_CONSTANTS_H
#pragma once

#include "core/string/string_name.h"
#include "core/templates/hash_map.h"
Expand All @@ -47,5 +46,3 @@ class CoreConstants {
static bool is_global_enum(const StringName &p_enum);
static void get_enum_values(const StringName &p_enum, HashMap<StringName, int64_t> *p_values);
};

#endif // CORE_CONSTANTS_H
5 changes: 1 addition & 4 deletions core/core_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef CORE_GLOBALS_H
#define CORE_GLOBALS_H
#pragma once

// Home for state needed from global functions
// that cannot be stored in Engine or OS due to e.g. circular includes
Expand All @@ -40,5 +39,3 @@ class CoreGlobals {
static bool print_line_enabled;
static bool print_error_enabled;
};

#endif // CORE_GLOBALS_H
5 changes: 1 addition & 4 deletions core/core_string_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef CORE_STRING_NAMES_H
#define CORE_STRING_NAMES_H
#pragma once

#include "core/string/string_name.h"

Expand Down Expand Up @@ -87,5 +86,3 @@ class CoreStringNames {
};

#define CoreStringName(m_name) CoreStringNames::get_singleton()->m_name

#endif // CORE_STRING_NAMES_H
5 changes: 1 addition & 4 deletions core/crypto/aes_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef AES_CONTEXT_H
#define AES_CONTEXT_H
#pragma once

#include "core/crypto/crypto_core.h"
#include "core/object/ref_counted.h"
Expand Down Expand Up @@ -64,5 +63,3 @@ class AESContext : public RefCounted {
};

VARIANT_ENUM_CAST(AESContext::Mode);

#endif // AES_CONTEXT_H
5 changes: 1 addition & 4 deletions core/crypto/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef CRYPTO_H
#define CRYPTO_H
#pragma once

#include "core/crypto/hashing_context.h"
#include "core/io/resource.h"
Expand Down Expand Up @@ -167,5 +166,3 @@ class ResourceFormatSaverCrypto : public ResourceFormatSaver {
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
virtual bool recognize(const Ref<Resource> &p_resource) const override;
};

#endif // CRYPTO_H
5 changes: 1 addition & 4 deletions core/crypto/crypto_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef CRYPTO_CORE_H
#define CRYPTO_CORE_H
#pragma once

#include "core/object/ref_counted.h"

Expand Down Expand Up @@ -115,5 +114,3 @@ class CryptoCore {
static Error sha1(const uint8_t *p_src, int p_src_len, unsigned char r_hash[20]);
static Error sha256(const uint8_t *p_src, int p_src_len, unsigned char r_hash[32]);
};

#endif // CRYPTO_CORE_H
5 changes: 1 addition & 4 deletions core/crypto/hashing_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef HASHING_CONTEXT_H
#define HASHING_CONTEXT_H
#pragma once

#include "core/object/ref_counted.h"

Expand Down Expand Up @@ -62,5 +61,3 @@ class HashingContext : public RefCounted {
};

VARIANT_ENUM_CAST(HashingContext::HashType);

#endif // HASHING_CONTEXT_H
5 changes: 1 addition & 4 deletions core/debugger/debugger_marshalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef DEBUGGER_MARSHALLS_H
#define DEBUGGER_MARSHALLS_H
#pragma once

#include "core/input/shortcut.h"
#include "core/object/script_language.h"
Expand Down Expand Up @@ -73,5 +72,3 @@ struct DebuggerMarshalls {
static Array serialize_key_shortcut(const Ref<Shortcut> &p_shortcut);
static Ref<Shortcut> deserialize_key_shortcut(const Array &p_keys);
};

#endif // DEBUGGER_MARSHALLS_H
5 changes: 1 addition & 4 deletions core/debugger/engine_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef ENGINE_DEBUGGER_H
#define ENGINE_DEBUGGER_H
#pragma once

#include "core/string/string_name.h"
#include "core/string/ustring.h"
Expand Down Expand Up @@ -140,5 +139,3 @@ class EngineDebugger {

virtual ~EngineDebugger();
};

#endif // ENGINE_DEBUGGER_H
5 changes: 1 addition & 4 deletions core/debugger/engine_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef ENGINE_PROFILER_H
#define ENGINE_PROFILER_H
#pragma once

#include "core/object/gdvirtual.gen.inc"
#include "core/object/ref_counted.h"
Expand Down Expand Up @@ -59,5 +58,3 @@ class EngineProfiler : public RefCounted {
EngineProfiler() {}
virtual ~EngineProfiler();
};

#endif // ENGINE_PROFILER_H
5 changes: 1 addition & 4 deletions core/debugger/local_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef LOCAL_DEBUGGER_H
#define LOCAL_DEBUGGER_H
#pragma once

#include "core/debugger/engine_debugger.h"
#include "core/object/script_language.h"
Expand All @@ -55,5 +54,3 @@ class LocalDebugger : public EngineDebugger {
LocalDebugger();
~LocalDebugger();
};

#endif // LOCAL_DEBUGGER_H
5 changes: 1 addition & 4 deletions core/debugger/remote_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef REMOTE_DEBUGGER_H
#define REMOTE_DEBUGGER_H
#pragma once

#include "core/debugger/debugger_marshalls.h"
#include "core/debugger/engine_debugger.h"
Expand Down Expand Up @@ -122,5 +121,3 @@ class RemoteDebugger : public EngineDebugger {
explicit RemoteDebugger(Ref<RemoteDebuggerPeer> p_peer);
~RemoteDebugger();
};

#endif // REMOTE_DEBUGGER_H
5 changes: 1 addition & 4 deletions core/debugger/remote_debugger_peer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef REMOTE_DEBUGGER_PEER_H
#define REMOTE_DEBUGGER_PEER_H
#pragma once

#include "core/io/stream_peer_tcp.h"
#include "core/object/ref_counted.h"
Expand Down Expand Up @@ -92,5 +91,3 @@ class RemoteDebuggerPeerTCP : public RemoteDebuggerPeer {
RemoteDebuggerPeerTCP(Ref<StreamPeerTCP> p_stream = Ref<StreamPeerTCP>());
~RemoteDebuggerPeerTCP();
};

#endif // REMOTE_DEBUGGER_PEER_H
5 changes: 1 addition & 4 deletions core/debugger/script_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef SCRIPT_DEBUGGER_H
#define SCRIPT_DEBUGGER_H
#pragma once

#include "core/object/script_language.h"
#include "core/string/string_name.h"
Expand Down Expand Up @@ -82,5 +81,3 @@ class ScriptDebugger {
Vector<StackInfo> get_error_stack_info() const;
ScriptDebugger() {}
};

#endif // SCRIPT_DEBUGGER_H
5 changes: 1 addition & 4 deletions core/doc_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef DOC_DATA_H
#define DOC_DATA_H
#pragma once

#include "core/io/xml_parser.h"
#include "core/variant/variant.h"
Expand Down Expand Up @@ -980,5 +979,3 @@ class DocData {
static void argument_doc_from_arginfo(DocData::ArgumentDoc &p_argument, const PropertyInfo &p_arginfo);
static void method_doc_from_methodinfo(DocData::MethodDoc &p_method, const MethodInfo &p_methodinfo, const String &p_desc);
};

#endif // DOC_DATA_H
5 changes: 1 addition & 4 deletions core/error/error_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef ERROR_LIST_H
#define ERROR_LIST_H
#pragma once

/** Error List. Please never compare an error against FAILED
* Either do result != OK , or !result. This way, Error fail
Expand Down Expand Up @@ -98,5 +97,3 @@ enum Error {
};

extern const char *error_names[];

#endif // ERROR_LIST_H
5 changes: 1 addition & 4 deletions core/error/error_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef ERROR_MACROS_H
#define ERROR_MACROS_H
#pragma once

#include "core/object/object_id.h"
#include "core/typedefs.h"
Expand Down Expand Up @@ -845,5 +844,3 @@ void _physics_interpolation_warning(const char *p_function, const char *p_file,

#define PHYSICS_INTERPOLATION_WARNING(m_string) \
_physics_interpolation_warning(FUNCTION_STR, __FILE__, __LINE__, ObjectID(UINT64_MAX), m_string)

#endif // ERROR_MACROS_H
5 changes: 1 addition & 4 deletions core/extension/extension_api_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef EXTENSION_API_DUMP_H
#define EXTENSION_API_DUMP_H
#pragma once

#include "core/extension/gdextension.h"

Expand All @@ -42,5 +41,3 @@ class GDExtensionAPIDump {
static Error validate_extension_json_file(const String &p_path);
};
#endif

#endif // EXTENSION_API_DUMP_H
5 changes: 1 addition & 4 deletions core/extension/gdextension.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef GDEXTENSION_H
#define GDEXTENSION_H
#pragma once

#include "core/extension/gdextension_interface.h"
#include "core/extension/gdextension_loader.h"
Expand Down Expand Up @@ -226,5 +225,3 @@ class GDExtensionEditorHelp {
};

#endif // TOOLS_ENABLED

#endif // GDEXTENSION_H
5 changes: 1 addition & 4 deletions core/extension/gdextension_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef GDEXTENSION_INTERFACE_H
#define GDEXTENSION_INTERFACE_H
#pragma once

/* This is a C class header, you can copy it and use it directly in your own binders.
* Together with the JSON file, you should be able to generate any binder.
Expand Down Expand Up @@ -3104,5 +3103,3 @@ typedef void (*GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen)(const
#ifdef __cplusplus
}
#endif

#endif // GDEXTENSION_INTERFACE_H
5 changes: 1 addition & 4 deletions core/extension/gdextension_library_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef GDEXTENSION_LIBRARY_LOADER_H
#define GDEXTENSION_LIBRARY_LOADER_H
#pragma once

#include <functional>

Expand Down Expand Up @@ -81,5 +80,3 @@ class GDExtensionLibraryLoader : public GDExtensionLoader {

Error parse_gdextension_file(const String &p_path);
};

#endif // GDEXTENSION_LIBRARY_LOADER_H
Loading

0 comments on commit b5bdb88

Please sign in to comment.