From 107cb1da5ea65e4bf46225f8b5e79be9fcc141e4 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Fri, 7 Mar 2025 17:52:09 -0600 Subject: [PATCH 1/3] Style: Integrate `#pragma once` in builders/checks --- binding_generator.py | 74 ++++--------------- misc/scripts/header_guards.py | 131 ++++++++++++---------------------- 2 files changed, 59 insertions(+), 146 deletions(-) diff --git a/binding_generator.py b/binding_generator.py index 103214e2..d62c4898 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -51,11 +51,7 @@ virtual $RETVAL _##m_name($FUNCARGS) $CONST override; \\ def generate_wrappers(target): max_versions = 12 - txt = """ -#ifndef GDEXTENSION_WRAPPERS_GEN_H -#define GDEXTENSION_WRAPPERS_GEN_H - -""" + txt = "#pragma once" for i in range(max_versions + 1): txt += "\n/* Module Wrapper " + str(i) + " Arguments */\n" @@ -64,8 +60,6 @@ def generate_wrappers(target): txt += generate_mod_version(i, True, False) txt += generate_mod_version(i, True, True) - txt += "\n#endif\n" - with open(target, "w", encoding="utf-8") as f: f.write(txt) @@ -187,8 +181,7 @@ def generate_virtuals(target): max_versions = 12 txt = """/* THIS FILE IS GENERATED DO NOT EDIT */ -#ifndef GDEXTENSION_GDVIRTUAL_GEN_H -#define GDEXTENSION_GDVIRTUAL_GEN_H +#pragma once """ @@ -203,8 +196,6 @@ def generate_virtuals(target): txt += generate_virtual_version(i, True, False, True) txt += generate_virtual_version(i, True, True, True) - txt += "#endif // GDEXTENSION_GDVIRTUAL_GEN_H\n" - with open(target, "w", encoding="utf-8") as f: f.write(txt) @@ -359,11 +350,8 @@ def generate_builtin_bindings(api, output_dir, build_config): variant_size_source = [] add_header("variant_size.hpp", variant_size_source) - header_guard = "GODOT_CPP_VARIANT_SIZE_HPP" - variant_size_source.append(f"#ifndef {header_guard}") - variant_size_source.append(f"#define {header_guard}") + variant_size_source.append("#pragma once") variant_size_source.append(f'#define GODOT_CPP_VARIANT_SIZE {builtin_sizes["Variant"]}') - variant_size_source.append(f"#endif // ! {header_guard}") variant_size_file.write("\n".join(variant_size_source)) @@ -443,8 +431,7 @@ def generate_builtin_bindings(api, output_dir, build_config): builtin_header = [] add_header("builtin_types.hpp", builtin_header) - builtin_header.append("#ifndef GODOT_CPP_BUILTIN_TYPES_HPP") - builtin_header.append("#define GODOT_CPP_BUILTIN_TYPES_HPP") + builtin_header.append("#pragma once") builtin_header.append("") @@ -459,8 +446,6 @@ def generate_builtin_bindings(api, output_dir, build_config): builtin_header.append("") - builtin_header.append("#endif // ! GODOT_CPP_BUILTIN_TYPES_HPP") - builtin_header_file.write("\n".join(builtin_header)) # Create a header with bindings for builtin types. @@ -469,8 +454,7 @@ def generate_builtin_bindings(api, output_dir, build_config): builtin_binds = [] add_header("builtin_binds.hpp", builtin_binds) - builtin_binds.append("#ifndef GODOT_CPP_BUILTIN_BINDS_HPP") - builtin_binds.append("#define GODOT_CPP_BUILTIN_BINDS_HPP") + builtin_binds.append("#pragma once") builtin_binds.append("") builtin_binds.append("#include ") builtin_binds.append("") @@ -482,7 +466,6 @@ def generate_builtin_bindings(api, output_dir, build_config): builtin_binds.append(f"VARIANT_ENUM_CAST({builtin_api['name']}::{enum_api['name']});") builtin_binds.append("") - builtin_binds.append("#endif // ! GODOT_CPP_BUILTIN_BINDS_HPP") builtin_binds_file.write("\n".join(builtin_binds)) @@ -498,9 +481,7 @@ def generate_builtin_class_vararg_method_implements_header(builtin_classes): add_header("builtin_vararg_methods.hpp", result) - header_guard = "GODOT_CPP_BUILTIN_VARARG_METHODS_HPP" - result.append(f"#ifndef {header_guard}") - result.append(f"#define {header_guard}") + result.append("#pragma once") result.append("") for builtin_api in builtin_classes: if "methods" not in builtin_api: @@ -515,8 +496,6 @@ def generate_builtin_class_vararg_method_implements_header(builtin_classes): ) result.append("") - result.append(f"#endif // ! {header_guard}") - return "\n".join(result) @@ -526,12 +505,9 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl class_name = builtin_api["name"] snake_class_name = camel_to_snake(class_name).upper() - header_guard = f"GODOT_CPP_{snake_class_name}_HPP" - add_header(f"{snake_class_name.lower()}.hpp", result) - result.append(f"#ifndef {header_guard}") - result.append(f"#define {header_guard}") + result.append("#pragma once") result.append("") result.append("#include ") @@ -960,8 +936,6 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl result.append("") result.append("} // namespace godot") - result.append("") - result.append(f"#endif // ! {header_guard}") result.append("") return "\n".join(result) @@ -1493,9 +1467,7 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node): result = [] add_header(f"{snake_struct_name}.hpp", result) - header_guard = f"GODOT_CPP_{snake_struct_name.upper()}_HPP" - result.append(f"#ifndef {header_guard}") - result.append(f"#define {header_guard}") + result.append("#pragma once") used_classes = [] expanded_format = native_struct["format"].replace("(", " ").replace(")", ";").replace(",", ";") @@ -1535,7 +1507,6 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node): result.append("") result.append("} // namespace godot") result.append("") - result.append(f"#endif // ! {header_guard}") with header_filename.open("w+", encoding="utf-8") as header_file: header_file.write("\n".join(result)) @@ -1551,11 +1522,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us add_header(f"{snake_class_name.lower()}.hpp", result) - header_guard = f"GODOT_CPP_{snake_class_name}_HPP" - - result.append(f"#ifndef {header_guard}") - result.append(f"#define {header_guard}") - + result.append("#pragma once") result.append("") if len(fully_used_classes) > 0: @@ -1844,7 +1811,6 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us result.append("\t") result.append("") - result.append(f"#endif // ! {header_guard}") result.append("") return "\n".join(result) @@ -2046,9 +2012,7 @@ def generate_global_constants(api, output_dir): header_filename = include_gen_folder / "global_constants.hpp" - header_guard = "GODOT_CPP_GLOBAL_CONSTANTS_HPP" - header.append(f"#ifndef {header_guard}") - header.append(f"#define {header_guard}") + header.append("#pragma once") header.append("") header.append("#include ") header.append("") @@ -2078,7 +2042,6 @@ def generate_global_constants(api, output_dir): header.append("} // namespace godot") header.append("") - header.append(f"#endif // ! {header_guard}") with header_filename.open("w+", encoding="utf-8") as header_file: header_file.write("\n".join(header)) @@ -2094,9 +2057,7 @@ def generate_version_header(api, output_dir): header_file_path = include_gen_folder / header_filename - header_guard = "GODOT_CPP_VERSION_HPP" - header.append(f"#ifndef {header_guard}") - header.append(f"#define {header_guard}") + header.append("#pragma once") header.append("") header.append(f"#define GODOT_VERSION_MAJOR {api['header']['version_major']}") @@ -2105,8 +2066,6 @@ def generate_version_header(api, output_dir): header.append(f"#define GODOT_VERSION_STATUS \"{api['header']['version_status']}\"") header.append(f"#define GODOT_VERSION_BUILD \"{api['header']['version_build']}\"") - header.append("") - header.append(f"#endif // {header_guard}") header.append("") with header_file_path.open("w+", encoding="utf-8") as header_file: @@ -2127,9 +2086,7 @@ def generate_global_constant_binds(api, output_dir): header_filename = include_gen_folder / "global_constants_binds.hpp" - header_guard = "GODOT_CPP_GLOBAL_CONSTANTS_BINDS_HPP" - header.append(f"#ifndef {header_guard}") - header.append(f"#define {header_guard}") + header.append("#pragma once") header.append("") header.append("#include ") header.append("") @@ -2148,8 +2105,6 @@ def generate_global_constant_binds(api, output_dir): header.append("") - header.append(f"#endif // ! {header_guard}") - with header_filename.open("w+", encoding="utf-8") as header_file: header_file.write("\n".join(header)) @@ -2168,9 +2123,7 @@ def generate_utility_functions(api, output_dir): header_filename = include_gen_folder / "utility_functions.hpp" - header_guard = "GODOT_CPP_UTILITY_FUNCTIONS_HPP" - header.append(f"#ifndef {header_guard}") - header.append(f"#define {header_guard}") + header.append("#pragma once") header.append("") header.append("#include ") header.append("#include ") @@ -2209,7 +2162,6 @@ def generate_utility_functions(api, output_dir): header.append("") header.append("} // namespace godot") header.append("") - header.append(f"#endif // ! {header_guard}") with header_filename.open("w+", encoding="utf-8") as header_file: header_file.write("\n".join(header)) diff --git a/misc/scripts/header_guards.py b/misc/scripts/header_guards.py index c99c4220..63a6b75f 100644 --- a/misc/scripts/header_guards.py +++ b/misc/scripts/header_guards.py @@ -2,121 +2,82 @@ # -*- coding: utf-8 -*- import sys -from pathlib import Path if len(sys.argv) < 2: print("Invalid usage of header_guards.py, it should be called with a path to one or multiple files.") sys.exit(1) -HEADER_CHECK_OFFSET = 30 -HEADER_BEGIN_OFFSET = 31 -HEADER_END_OFFSET = -1 - changed = [] invalid = [] for file in sys.argv[1:]: - with open(file, "rt", encoding="utf-8", newline="\n") as f: + header_start = -1 + header_end = -1 + + with open(file.strip(), "rt", encoding="utf-8", newline="\n") as f: lines = f.readlines() - if len(lines) <= HEADER_BEGIN_OFFSET: - continue # Most likely a dummy file. + for idx, line in enumerate(lines): + sline = line.strip() - if lines[HEADER_CHECK_OFFSET].startswith("#import"): - continue # Early catch obj-c file. + if header_start < 0: + if sline == "": # Skip empty lines at the top. + continue - name = f"GODOT_{Path(file).name}".upper().replace(".", "_").replace("-", "_").replace(" ", "_") + if sline.startswith("/**********"): # Godot header starts this way. + header_start = idx + else: + header_end = 0 # There is no Godot header. + break + else: + if not sline.startswith(("*", "/*")): # Not in the Godot header anymore. + header_end = idx + 1 # The guard should be two lines below the Godot header. + break - HEADER_CHECK = f"#ifndef {name}\n" - HEADER_BEGIN = f"#define {name}\n" - HEADER_END = f"#endif // {name}\n" - - if ( - lines[HEADER_CHECK_OFFSET] == HEADER_CHECK - and lines[HEADER_BEGIN_OFFSET] == HEADER_BEGIN - and lines[HEADER_END_OFFSET] == HEADER_END - ): + if (HEADER_CHECK_OFFSET := header_end) < 0 or HEADER_CHECK_OFFSET >= len(lines): + invalid.append(file) + continue + + if lines[HEADER_CHECK_OFFSET].startswith("#pragma once"): + continue + + # Might be using legacy header guards. + HEADER_BEGIN_OFFSET = HEADER_CHECK_OFFSET + 1 + HEADER_END_OFFSET = len(lines) - 1 + + if HEADER_BEGIN_OFFSET >= HEADER_END_OFFSET: + invalid.append(file) continue - # Guards might exist but with the wrong names. if ( lines[HEADER_CHECK_OFFSET].startswith("#ifndef") and lines[HEADER_BEGIN_OFFSET].startswith("#define") and lines[HEADER_END_OFFSET].startswith("#endif") ): - lines[HEADER_CHECK_OFFSET] = HEADER_CHECK - lines[HEADER_BEGIN_OFFSET] = HEADER_BEGIN - lines[HEADER_END_OFFSET] = HEADER_END + lines[HEADER_CHECK_OFFSET] = "#pragma once" + lines[HEADER_BEGIN_OFFSET] = "\n" + lines.pop() with open(file, "wt", encoding="utf-8", newline="\n") as f: f.writelines(lines) changed.append(file) continue - header_check = -1 - header_begin = -1 - header_end = -1 - pragma_once = -1 - objc = False - - for idx, line in enumerate(lines): - if not line.startswith("#"): - continue - elif line.startswith("#ifndef") and header_check == -1: - header_check = idx - elif line.startswith("#define") and header_begin == -1: - header_begin = idx - elif line.startswith("#endif") and header_end == -1: - header_end = idx - elif line.startswith("#pragma once"): - pragma_once = idx - break - elif line.startswith("#import"): - objc = True + # Verify `#pragma once` doesn't exist at invalid location. + misplaced = False + for line in lines: + if line.startswith("#pragma once"): + misplaced = True break - if objc: + if misplaced: + invalid.append(file) continue - if pragma_once != -1: - lines.pop(pragma_once) - lines.insert(HEADER_CHECK_OFFSET, HEADER_CHECK) - lines.insert(HEADER_BEGIN_OFFSET, HEADER_BEGIN) - lines.append("\n") - lines.append(HEADER_END) - with open(file, "wt", encoding="utf-8", newline="\n") as f: - f.writelines(lines) - changed.append(file) - continue - - if header_check == -1 and header_begin == -1 and header_end == -1: - # Guards simply didn't exist - lines.insert(HEADER_CHECK_OFFSET, HEADER_CHECK) - lines.insert(HEADER_BEGIN_OFFSET, HEADER_BEGIN) - lines.append("\n") - lines.append(HEADER_END) - with open(file, "wt", encoding="utf-8", newline="\n") as f: - f.writelines(lines) - changed.append(file) - continue - - if header_check != -1 and header_begin != -1 and header_end != -1: - # All prepends "found", see if we can salvage this. - if header_check == header_begin - 1 and header_begin < header_end: - lines.pop(header_check) - lines.pop(header_begin - 1) - lines.pop(header_end - 2) - if lines[header_end - 3] == "\n": - lines.pop(header_end - 3) - lines.insert(HEADER_CHECK_OFFSET, HEADER_CHECK) - lines.insert(HEADER_BEGIN_OFFSET, HEADER_BEGIN) - lines.append("\n") - lines.append(HEADER_END) - with open(file, "wt", encoding="utf-8", newline="\n") as f: - f.writelines(lines) - changed.append(file) - continue - - invalid.append(file) + # Assume that we're simply missing a guard entirely. + lines.insert(HEADER_CHECK_OFFSET, "#pragma once\n\n") + with open(file, "wt", encoding="utf-8", newline="\n") as f: + f.writelines(lines) + changed.append(file) if changed: for file in changed: From 7056c996dd43ae1aa466c94d95cc2fe63853d8a9 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Fri, 7 Mar 2025 17:58:10 -0600 Subject: [PATCH 2/3] Style: Replace header guards with `#pragma once` --- include/godot_cpp/classes/editor_plugin_registration.hpp | 5 +---- include/godot_cpp/classes/ref.hpp | 5 +---- include/godot_cpp/classes/wrapped.hpp | 5 +---- include/godot_cpp/core/binder_common.hpp | 5 +---- include/godot_cpp/core/builtin_ptrcall.hpp | 5 +---- include/godot_cpp/core/class_db.hpp | 5 +---- include/godot_cpp/core/defs.hpp | 5 +---- include/godot_cpp/core/engine_ptrcall.hpp | 5 +---- include/godot_cpp/core/error_macros.hpp | 5 +---- include/godot_cpp/core/math.hpp | 5 +---- include/godot_cpp/core/memory.hpp | 5 +---- include/godot_cpp/core/method_bind.hpp | 5 +---- include/godot_cpp/core/method_ptrcall.hpp | 5 +---- include/godot_cpp/core/mutex_lock.hpp | 5 +---- include/godot_cpp/core/object.hpp | 5 +---- include/godot_cpp/core/object_id.hpp | 5 +---- include/godot_cpp/core/print_string.hpp | 5 +---- include/godot_cpp/core/property_info.hpp | 5 +---- include/godot_cpp/core/type_info.hpp | 5 +---- include/godot_cpp/godot.hpp | 5 +---- include/godot_cpp/templates/cowdata.hpp | 5 +---- include/godot_cpp/templates/hash_map.hpp | 5 +---- include/godot_cpp/templates/hash_set.hpp | 5 +---- include/godot_cpp/templates/hashfuncs.hpp | 5 +---- include/godot_cpp/templates/list.hpp | 5 +---- include/godot_cpp/templates/local_vector.hpp | 5 +---- include/godot_cpp/templates/pair.hpp | 5 +---- include/godot_cpp/templates/rb_map.hpp | 5 +---- include/godot_cpp/templates/rb_set.hpp | 5 +---- include/godot_cpp/templates/rid_owner.hpp | 5 +---- include/godot_cpp/templates/safe_refcount.hpp | 5 +---- include/godot_cpp/templates/search_array.hpp | 5 +---- include/godot_cpp/templates/self_list.hpp | 5 +---- include/godot_cpp/templates/sort_array.hpp | 5 +---- include/godot_cpp/templates/spin_lock.hpp | 5 +---- include/godot_cpp/templates/thread_work_pool.hpp | 5 +---- include/godot_cpp/templates/vector.hpp | 5 +---- include/godot_cpp/templates/vmap.hpp | 5 +---- include/godot_cpp/templates/vset.hpp | 5 +---- include/godot_cpp/variant/aabb.hpp | 5 +---- include/godot_cpp/variant/array_helpers.hpp | 5 +---- include/godot_cpp/variant/basis.hpp | 5 +---- include/godot_cpp/variant/callable_custom.hpp | 5 +---- include/godot_cpp/variant/callable_method_pointer.hpp | 5 +---- include/godot_cpp/variant/char_string.hpp | 5 +---- include/godot_cpp/variant/char_utils.hpp | 5 +---- include/godot_cpp/variant/color.hpp | 5 +---- include/godot_cpp/variant/color_names.inc.hpp | 5 +---- include/godot_cpp/variant/plane.hpp | 5 +---- include/godot_cpp/variant/projection.hpp | 5 +---- include/godot_cpp/variant/quaternion.hpp | 5 +---- include/godot_cpp/variant/rect2.hpp | 5 +---- include/godot_cpp/variant/rect2i.hpp | 5 +---- include/godot_cpp/variant/transform2d.hpp | 5 +---- include/godot_cpp/variant/transform3d.hpp | 5 +---- include/godot_cpp/variant/typed_array.hpp | 5 +---- include/godot_cpp/variant/typed_dictionary.hpp | 5 +---- include/godot_cpp/variant/variant.hpp | 5 +---- include/godot_cpp/variant/variant_internal.hpp | 5 +---- include/godot_cpp/variant/vector2.hpp | 5 +---- include/godot_cpp/variant/vector2i.hpp | 5 +---- include/godot_cpp/variant/vector3.hpp | 5 +---- include/godot_cpp/variant/vector3i.hpp | 5 +---- include/godot_cpp/variant/vector4.hpp | 5 +---- include/godot_cpp/variant/vector4i.hpp | 5 +---- test/src/example.h | 5 +---- test/src/register_types.h | 5 +---- test/src/tests.h | 5 +---- 68 files changed, 68 insertions(+), 272 deletions(-) diff --git a/include/godot_cpp/classes/editor_plugin_registration.hpp b/include/godot_cpp/classes/editor_plugin_registration.hpp index 7870bfc7..366008a4 100644 --- a/include/godot_cpp/classes/editor_plugin_registration.hpp +++ b/include/godot_cpp/classes/editor_plugin_registration.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_EDITOR_PLUGIN_REGISTRATION_HPP -#define GODOT_EDITOR_PLUGIN_REGISTRATION_HPP +#pragma once #include @@ -58,5 +57,3 @@ public: }; } // namespace godot - -#endif // GODOT_EDITOR_PLUGIN_REGISTRATION_HPP diff --git a/include/godot_cpp/classes/ref.hpp b/include/godot_cpp/classes/ref.hpp index 8511fe4c..8a5a9aa9 100644 --- a/include/godot_cpp/classes/ref.hpp +++ b/include/godot_cpp/classes/ref.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_REF_HPP -#define GODOT_REF_HPP +#pragma once #include @@ -284,5 +283,3 @@ struct GetTypeInfo &, typename EnableIf }; } // namespace godot - -#endif // GODOT_REF_HPP diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp index 7a07dcb1..2b4a9035 100644 --- a/include/godot_cpp/classes/wrapped.hpp +++ b/include/godot_cpp/classes/wrapped.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_WRAPPED_HPP -#define GODOT_WRAPPED_HPP +#pragma once #include @@ -511,5 +510,3 @@ private: #define GDVIRTUAL_BIND(m_name, ...) ::godot::ClassDB::add_virtual_method(get_class_static(), _gdvirtual_##m_name##_get_method_info(), ::godot::snarray(__VA_ARGS__)); #define GDVIRTUAL_IS_OVERRIDDEN(m_name) _gdvirtual_##m_name##_overridden() #define GDVIRTUAL_IS_OVERRIDDEN_PTR(m_obj, m_name) m_obj->_gdvirtual_##m_name##_overridden() - -#endif // GODOT_WRAPPED_HPP diff --git a/include/godot_cpp/core/binder_common.hpp b/include/godot_cpp/core/binder_common.hpp index 26ed4ca3..6a877735 100644 --- a/include/godot_cpp/core/binder_common.hpp +++ b/include/godot_cpp/core/binder_common.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_BINDER_COMMON_HPP -#define GODOT_BINDER_COMMON_HPP +#pragma once #include @@ -692,5 +691,3 @@ void call_with_ptr_args_static_method_ret(R (*p_method)(P...), const GDExtension #include #include - -#endif // GODOT_BINDER_COMMON_HPP diff --git a/include/godot_cpp/core/builtin_ptrcall.hpp b/include/godot_cpp/core/builtin_ptrcall.hpp index 286051fa..cf5310e2 100644 --- a/include/godot_cpp/core/builtin_ptrcall.hpp +++ b/include/godot_cpp/core/builtin_ptrcall.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_BUILTIN_PTRCALL_HPP -#define GODOT_BUILTIN_PTRCALL_HPP +#pragma once #include #include @@ -88,5 +87,3 @@ T _call_builtin_ptr_getter(const GDExtensionPtrGetter getter, GDExtensionConstTy } // namespace internal } // namespace godot - -#endif // GODOT_BUILTIN_PTRCALL_HPP diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index ca20c44f..1dcfebe3 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_CLASS_DB_HPP -#define GODOT_CLASS_DB_HPP +#pragma once #include @@ -370,5 +369,3 @@ MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p } // namespace godot CLASSDB_SINGLETON_VARIANT_CAST; - -#endif // GODOT_CLASS_DB_HPP diff --git a/include/godot_cpp/core/defs.hpp b/include/godot_cpp/core/defs.hpp index 07ce14d3..c5115aa9 100644 --- a/include/godot_cpp/core/defs.hpp +++ b/include/godot_cpp/core/defs.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_DEFS_HPP -#define GODOT_DEFS_HPP +#pragma once #include #include @@ -130,5 +129,3 @@ struct BuildIndexSequence<0, Is...> : IndexSequence {}; // To maintain compatibility an alias is defined outside the namespace. // Consider it deprecated. using real_t = godot::real_t; - -#endif // GODOT_DEFS_HPP diff --git a/include/godot_cpp/core/engine_ptrcall.hpp b/include/godot_cpp/core/engine_ptrcall.hpp index 555806b8..c8c80041 100644 --- a/include/godot_cpp/core/engine_ptrcall.hpp +++ b/include/godot_cpp/core/engine_ptrcall.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_ENGINE_PTRCALL_HPP -#define GODOT_ENGINE_PTRCALL_HPP +#pragma once #include @@ -93,5 +92,3 @@ void _call_utility_no_ret(const GDExtensionPtrUtilityFunction func, const Args & } // namespace internal } // namespace godot - -#endif // GODOT_ENGINE_PTRCALL_HPP diff --git a/include/godot_cpp/core/error_macros.hpp b/include/godot_cpp/core/error_macros.hpp index a27c2cb0..1337b0b7 100644 --- a/include/godot_cpp/core/error_macros.hpp +++ b/include/godot_cpp/core/error_macros.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_ERROR_MACROS_HPP -#define GODOT_ERROR_MACROS_HPP +#pragma once #include @@ -802,5 +801,3 @@ void _err_flush_stdout(); #define CHECK_METHOD_BIND_RET(m_mb, m_ret) #define CHECK_METHOD_BIND(m_mb) #endif - -#endif // GODOT_ERROR_MACROS_HPP diff --git a/include/godot_cpp/core/math.hpp b/include/godot_cpp/core/math.hpp index 1949360a..7da52109 100644 --- a/include/godot_cpp/core/math.hpp +++ b/include/godot_cpp/core/math.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_MATH_HPP -#define GODOT_MATH_HPP +#pragma once #include @@ -815,5 +814,3 @@ inline float snap_scalar_separation(float p_offset, float p_step, float p_target } // namespace Math } // namespace godot - -#endif // GODOT_MATH_HPP diff --git a/include/godot_cpp/core/memory.hpp b/include/godot_cpp/core/memory.hpp index 1934ee45..4905ba89 100644 --- a/include/godot_cpp/core/memory.hpp +++ b/include/godot_cpp/core/memory.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_MEMORY_HPP -#define GODOT_MEMORY_HPP +#pragma once #include #include @@ -216,5 +215,3 @@ struct _GlobalNilClass { }; } // namespace godot - -#endif // GODOT_MEMORY_HPP diff --git a/include/godot_cpp/core/method_bind.hpp b/include/godot_cpp/core/method_bind.hpp index f2da66ce..07d51be6 100644 --- a/include/godot_cpp/core/method_bind.hpp +++ b/include/godot_cpp/core/method_bind.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_METHOD_BIND_HPP -#define GODOT_METHOD_BIND_HPP +#pragma once #include #include @@ -731,5 +730,3 @@ MethodBind *create_static_method_bind(R (*p_method)(P...)) { } } // namespace godot - -#endif // GODOT_METHOD_BIND_HPP diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp index 8889e821..8c84dbc7 100644 --- a/include/godot_cpp/core/method_ptrcall.hpp +++ b/include/godot_cpp/core/method_ptrcall.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_METHOD_PTRCALL_HPP -#define GODOT_METHOD_PTRCALL_HPP +#pragma once #include @@ -234,5 +233,3 @@ GDVIRTUAL_NATIVE_PTR(float); GDVIRTUAL_NATIVE_PTR(double); } // namespace godot - -#endif // GODOT_METHOD_PTRCALL_HPP diff --git a/include/godot_cpp/core/mutex_lock.hpp b/include/godot_cpp/core/mutex_lock.hpp index aa81d4dc..4d0029a9 100644 --- a/include/godot_cpp/core/mutex_lock.hpp +++ b/include/godot_cpp/core/mutex_lock.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_MUTEX_LOCK_HPP -#define GODOT_MUTEX_LOCK_HPP +#pragma once #include @@ -55,5 +54,3 @@ public: #define _THREAD_SAFE_UNLOCK_ _thread_safe_.unlock(); } // namespace godot - -#endif // GODOT_MUTEX_LOCK_HPP diff --git a/include/godot_cpp/core/object.hpp b/include/godot_cpp/core/object.hpp index 917ec6cc..9eab6e5c 100644 --- a/include/godot_cpp/core/object.hpp +++ b/include/godot_cpp/core/object.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_OBJECT_HPP -#define GODOT_OBJECT_HPP +#pragma once #include @@ -148,5 +147,3 @@ const T *Object::cast_to(const Object *p_object) { } } // namespace godot - -#endif // GODOT_OBJECT_HPP diff --git a/include/godot_cpp/core/object_id.hpp b/include/godot_cpp/core/object_id.hpp index 9f3bc96f..815622b9 100644 --- a/include/godot_cpp/core/object_id.hpp +++ b/include/godot_cpp/core/object_id.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_OBJECT_ID_HPP -#define GODOT_OBJECT_ID_HPP +#pragma once #include @@ -58,5 +57,3 @@ public: }; } // namespace godot - -#endif // GODOT_OBJECT_ID_HPP diff --git a/include/godot_cpp/core/print_string.hpp b/include/godot_cpp/core/print_string.hpp index 61f4330c..69afaf07 100644 --- a/include/godot_cpp/core/print_string.hpp +++ b/include/godot_cpp/core/print_string.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_PRINT_STRING_HPP -#define GODOT_PRINT_STRING_HPP +#pragma once #include @@ -69,5 +68,3 @@ void print_verbose(const Variant &p_variant, Args... p_args) { bool is_print_verbose_enabled(); } // namespace godot - -#endif // GODOT_PRINT_STRING_HPP diff --git a/include/godot_cpp/core/property_info.hpp b/include/godot_cpp/core/property_info.hpp index dd71d48a..23da33e3 100644 --- a/include/godot_cpp/core/property_info.hpp +++ b/include/godot_cpp/core/property_info.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_PROPERTY_INFO_HPP -#define GODOT_PROPERTY_INFO_HPP +#pragma once #include @@ -128,5 +127,3 @@ struct PropertyInfo { }; } // namespace godot - -#endif // GODOT_PROPERTY_INFO_HPP diff --git a/include/godot_cpp/core/type_info.hpp b/include/godot_cpp/core/type_info.hpp index e131c510..59ad87e4 100644 --- a/include/godot_cpp/core/type_info.hpp +++ b/include/godot_cpp/core/type_info.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_TYPE_INFO_HPP -#define GODOT_TYPE_INFO_HPP +#pragma once #include #include @@ -416,5 +415,3 @@ MAKE_TYPED_ARRAY_INFO(IPAddress, Variant::STRING) #define CLASS_INFO(m_type) (GetTypeInfo::get_class_info()) } // namespace godot - -#endif // GODOT_TYPE_INFO_HPP diff --git a/include/godot_cpp/godot.hpp b/include/godot_cpp/godot.hpp index 40693aa7..7659f8a9 100644 --- a/include/godot_cpp/godot.hpp +++ b/include/godot_cpp/godot.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_GODOT_HPP -#define GODOT_GODOT_HPP +#pragma once #include @@ -265,5 +264,3 @@ public: }; } // namespace godot - -#endif // GODOT_GODOT_HPP diff --git a/include/godot_cpp/templates/cowdata.hpp b/include/godot_cpp/templates/cowdata.hpp index dcb74ecc..68918f7a 100644 --- a/include/godot_cpp/templates/cowdata.hpp +++ b/include/godot_cpp/templates/cowdata.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_COWDATA_HPP -#define GODOT_COWDATA_HPP +#pragma once #include #include @@ -488,5 +487,3 @@ CowData::~CowData() { #endif } // namespace godot - -#endif // GODOT_COWDATA_HPP diff --git a/include/godot_cpp/templates/hash_map.hpp b/include/godot_cpp/templates/hash_map.hpp index 59cd8e0b..67dfb4e7 100644 --- a/include/godot_cpp/templates/hash_map.hpp +++ b/include/godot_cpp/templates/hash_map.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_HASH_MAP_HPP -#define GODOT_HASH_MAP_HPP +#pragma once #include #include @@ -587,5 +586,3 @@ public: }; } // namespace godot - -#endif // GODOT_HASH_MAP_HPP diff --git a/include/godot_cpp/templates/hash_set.hpp b/include/godot_cpp/templates/hash_set.hpp index 1845a1bb..67ba443a 100644 --- a/include/godot_cpp/templates/hash_set.hpp +++ b/include/godot_cpp/templates/hash_set.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_HASH_SET_HPP -#define GODOT_HASH_SET_HPP +#pragma once #include #include @@ -473,5 +472,3 @@ public: }; } // namespace godot - -#endif // GODOT_HASH_SET_HPP diff --git a/include/godot_cpp/templates/hashfuncs.hpp b/include/godot_cpp/templates/hashfuncs.hpp index 40b10a9e..3fcedb69 100644 --- a/include/godot_cpp/templates/hashfuncs.hpp +++ b/include/godot_cpp/templates/hashfuncs.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_HASHFUNCS_HPP -#define GODOT_HASHFUNCS_HPP +#pragma once // Needed for fastmod. #if defined(_MSC_VER) @@ -522,5 +521,3 @@ static _FORCE_INLINE_ uint32_t fastmod(const uint32_t n, const uint64_t c, const } } // namespace godot - -#endif // GODOT_HASHFUNCS_HPP diff --git a/include/godot_cpp/templates/list.hpp b/include/godot_cpp/templates/list.hpp index fa596056..bbc818c7 100644 --- a/include/godot_cpp/templates/list.hpp +++ b/include/godot_cpp/templates/list.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_LIST_HPP -#define GODOT_LIST_HPP +#pragma once #include #include @@ -783,5 +782,3 @@ public: }; } // namespace godot - -#endif // GODOT_LIST_HPP diff --git a/include/godot_cpp/templates/local_vector.hpp b/include/godot_cpp/templates/local_vector.hpp index c5481e48..7b684874 100644 --- a/include/godot_cpp/templates/local_vector.hpp +++ b/include/godot_cpp/templates/local_vector.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_LOCAL_VECTOR_HPP -#define GODOT_LOCAL_VECTOR_HPP +#pragma once #include #include @@ -339,5 +338,3 @@ template using TightLocalVector = LocalVector; } // namespace godot - -#endif // GODOT_LOCAL_VECTOR_HPP diff --git a/include/godot_cpp/templates/pair.hpp b/include/godot_cpp/templates/pair.hpp index f8754130..5c064c1c 100644 --- a/include/godot_cpp/templates/pair.hpp +++ b/include/godot_cpp/templates/pair.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_PAIR_HPP -#define GODOT_PAIR_HPP +#pragma once namespace godot { @@ -103,5 +102,3 @@ struct KeyValueSort { }; } // namespace godot - -#endif // GODOT_PAIR_HPP diff --git a/include/godot_cpp/templates/rb_map.hpp b/include/godot_cpp/templates/rb_map.hpp index 6ab71fd7..0ddb1983 100644 --- a/include/godot_cpp/templates/rb_map.hpp +++ b/include/godot_cpp/templates/rb_map.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_RB_MAP_HPP -#define GODOT_RB_MAP_HPP +#pragma once #include #include @@ -761,5 +760,3 @@ public: }; } // namespace godot - -#endif // GODOT_RB_MAP_HPP diff --git a/include/godot_cpp/templates/rb_set.hpp b/include/godot_cpp/templates/rb_set.hpp index 69aa8d7f..f826896f 100644 --- a/include/godot_cpp/templates/rb_set.hpp +++ b/include/godot_cpp/templates/rb_set.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_RB_SET_HPP -#define GODOT_RB_SET_HPP +#pragma once #include @@ -710,5 +709,3 @@ public: }; } // namespace godot - -#endif // GODOT_RB_SET_HPP diff --git a/include/godot_cpp/templates/rid_owner.hpp b/include/godot_cpp/templates/rid_owner.hpp index 1dd4a393..6d27d402 100644 --- a/include/godot_cpp/templates/rid_owner.hpp +++ b/include/godot_cpp/templates/rid_owner.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_RID_OWNER_HPP -#define GODOT_RID_OWNER_HPP +#pragma once #include #include @@ -461,5 +460,3 @@ public: }; } // namespace godot - -#endif // GODOT_RID_OWNER_HPP diff --git a/include/godot_cpp/templates/safe_refcount.hpp b/include/godot_cpp/templates/safe_refcount.hpp index 98cb04b2..e6c29689 100644 --- a/include/godot_cpp/templates/safe_refcount.hpp +++ b/include/godot_cpp/templates/safe_refcount.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_SAFE_REFCOUNT_HPP -#define GODOT_SAFE_REFCOUNT_HPP +#pragma once #if !defined(NO_THREADS) @@ -331,5 +330,3 @@ public: #endif } // namespace godot - -#endif // GODOT_SAFE_REFCOUNT_HPP diff --git a/include/godot_cpp/templates/search_array.hpp b/include/godot_cpp/templates/search_array.hpp index 11a9db52..aa3374e8 100644 --- a/include/godot_cpp/templates/search_array.hpp +++ b/include/godot_cpp/templates/search_array.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_SEARCH_ARRAY_HPP -#define GODOT_SEARCH_ARRAY_HPP +#pragma once #include @@ -67,5 +66,3 @@ public: }; } // namespace godot - -#endif // GODOT_SEARCH_ARRAY_HPP diff --git a/include/godot_cpp/templates/self_list.hpp b/include/godot_cpp/templates/self_list.hpp index f7a65f68..cdd1f258 100644 --- a/include/godot_cpp/templates/self_list.hpp +++ b/include/godot_cpp/templates/self_list.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_SELF_LIST_HPP -#define GODOT_SELF_LIST_HPP +#pragma once #include #include @@ -139,5 +138,3 @@ public: }; } // namespace godot - -#endif // GODOT_SELF_LIST_HPP diff --git a/include/godot_cpp/templates/sort_array.hpp b/include/godot_cpp/templates/sort_array.hpp index 7ce5c784..c2727dd9 100644 --- a/include/godot_cpp/templates/sort_array.hpp +++ b/include/godot_cpp/templates/sort_array.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_SORT_ARRAY_HPP -#define GODOT_SORT_ARRAY_HPP +#pragma once #include @@ -319,5 +318,3 @@ public: }; } // namespace godot - -#endif // GODOT_SORT_ARRAY_HPP diff --git a/include/godot_cpp/templates/spin_lock.hpp b/include/godot_cpp/templates/spin_lock.hpp index 530d545e..17c21bc5 100644 --- a/include/godot_cpp/templates/spin_lock.hpp +++ b/include/godot_cpp/templates/spin_lock.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_SPIN_LOCK_HPP -#define GODOT_SPIN_LOCK_HPP +#pragma once #include @@ -50,5 +49,3 @@ public: }; } // namespace godot - -#endif // GODOT_SPIN_LOCK_HPP diff --git a/include/godot_cpp/templates/thread_work_pool.hpp b/include/godot_cpp/templates/thread_work_pool.hpp index cb20c6e9..190c1e00 100644 --- a/include/godot_cpp/templates/thread_work_pool.hpp +++ b/include/godot_cpp/templates/thread_work_pool.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_THREAD_WORK_POOL_HPP -#define GODOT_THREAD_WORK_POOL_HPP +#pragma once #include #include @@ -201,5 +200,3 @@ public: }; } // namespace godot - -#endif // GODOT_THREAD_WORK_POOL_HPP diff --git a/include/godot_cpp/templates/vector.hpp b/include/godot_cpp/templates/vector.hpp index aaa84f33..50593f30 100644 --- a/include/godot_cpp/templates/vector.hpp +++ b/include/godot_cpp/templates/vector.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VECTOR_HPP -#define GODOT_VECTOR_HPP +#pragma once /** * @class Vector @@ -332,5 +331,3 @@ void Vector::fill(T p_elem) { } } // namespace godot - -#endif // GODOT_VECTOR_HPP diff --git a/include/godot_cpp/templates/vmap.hpp b/include/godot_cpp/templates/vmap.hpp index 926ccd39..b6fa3c03 100644 --- a/include/godot_cpp/templates/vmap.hpp +++ b/include/godot_cpp/templates/vmap.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VMAP_HPP -#define GODOT_VMAP_HPP +#pragma once #include @@ -200,5 +199,3 @@ public: }; } // namespace godot - -#endif // GODOT_VMAP_HPP diff --git a/include/godot_cpp/templates/vset.hpp b/include/godot_cpp/templates/vset.hpp index ce21ba83..42167403 100644 --- a/include/godot_cpp/templates/vset.hpp +++ b/include/godot_cpp/templates/vset.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VSET_HPP -#define GODOT_VSET_HPP +#pragma once #include @@ -141,5 +140,3 @@ public: }; } // namespace godot - -#endif // GODOT_VSET_HPP diff --git a/include/godot_cpp/variant/aabb.hpp b/include/godot_cpp/variant/aabb.hpp index 46eaca96..17048d60 100644 --- a/include/godot_cpp/variant/aabb.hpp +++ b/include/godot_cpp/variant/aabb.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_AABB_HPP -#define GODOT_AABB_HPP +#pragma once #include #include @@ -491,5 +490,3 @@ AABB AABB::quantized(real_t p_unit) const { } } // namespace godot - -#endif // GODOT_AABB_HPP diff --git a/include/godot_cpp/variant/array_helpers.hpp b/include/godot_cpp/variant/array_helpers.hpp index 3d948aab..f408aa72 100644 --- a/include/godot_cpp/variant/array_helpers.hpp +++ b/include/godot_cpp/variant/array_helpers.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_ARRAY_HELPERS_HPP -#define GODOT_ARRAY_HELPERS_HPP +#pragma once namespace godot { namespace helpers { @@ -51,5 +50,3 @@ T append_all(T appendable) { } } // namespace helpers } // namespace godot - -#endif // GODOT_ARRAY_HELPERS_HPP diff --git a/include/godot_cpp/variant/basis.hpp b/include/godot_cpp/variant/basis.hpp index 4b7a6b44..6ede9ead 100644 --- a/include/godot_cpp/variant/basis.hpp +++ b/include/godot_cpp/variant/basis.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_BASIS_HPP -#define GODOT_BASIS_HPP +#pragma once #include #include @@ -315,5 +314,3 @@ real_t Basis::determinant() const { } } // namespace godot - -#endif // GODOT_BASIS_HPP diff --git a/include/godot_cpp/variant/callable_custom.hpp b/include/godot_cpp/variant/callable_custom.hpp index 48a81422..1ab18bd3 100644 --- a/include/godot_cpp/variant/callable_custom.hpp +++ b/include/godot_cpp/variant/callable_custom.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_CALLABLE_CUSTOM_HPP -#define GODOT_CALLABLE_CUSTOM_HPP +#pragma once #include #include @@ -61,5 +60,3 @@ public: }; } // namespace godot - -#endif // GODOT_CALLABLE_CUSTOM_HPP diff --git a/include/godot_cpp/variant/callable_method_pointer.hpp b/include/godot_cpp/variant/callable_method_pointer.hpp index f3d688b4..e9aea09b 100644 --- a/include/godot_cpp/variant/callable_method_pointer.hpp +++ b/include/godot_cpp/variant/callable_method_pointer.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_CALLABLE_METHOD_POINTER_HPP -#define GODOT_CALLABLE_METHOD_POINTER_HPP +#pragma once #include #include @@ -269,5 +268,3 @@ Callable create_custom_callable_static_function_pointer(R (*p_method)(P...)) { #define callable_mp_static(M) ::godot::create_custom_callable_static_function_pointer(M) } // namespace godot - -#endif // GODOT_CALLABLE_METHOD_POINTER_HPP diff --git a/include/godot_cpp/variant/char_string.hpp b/include/godot_cpp/variant/char_string.hpp index 991c0392..b7b795b5 100644 --- a/include/godot_cpp/variant/char_string.hpp +++ b/include/godot_cpp/variant/char_string.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_CHAR_STRING_HPP -#define GODOT_CHAR_STRING_HPP +#pragma once #include @@ -138,5 +137,3 @@ typedef CharStringT Char32String; typedef CharStringT CharWideString; } // namespace godot - -#endif // GODOT_CHAR_STRING_HPP diff --git a/include/godot_cpp/variant/char_utils.hpp b/include/godot_cpp/variant/char_utils.hpp index 066f7945..6b672be3 100644 --- a/include/godot_cpp/variant/char_utils.hpp +++ b/include/godot_cpp/variant/char_utils.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_CHAR_UTILS_HPP -#define GODOT_CHAR_UTILS_HPP +#pragma once static _FORCE_INLINE_ bool is_ascii_upper_case(char32_t c) { return (c >= 'A' && c <= 'Z'); @@ -86,5 +85,3 @@ static _FORCE_INLINE_ bool is_punct(char32_t p_char) { static _FORCE_INLINE_ bool is_underscore(char32_t p_char) { return (p_char == '_'); } - -#endif // GODOT_CHAR_UTILS_HPP diff --git a/include/godot_cpp/variant/color.hpp b/include/godot_cpp/variant/color.hpp index 86f1a396..878a7d87 100644 --- a/include/godot_cpp/variant/color.hpp +++ b/include/godot_cpp/variant/color.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_COLOR_HPP -#define GODOT_COLOR_HPP +#pragma once #include @@ -285,5 +284,3 @@ _FORCE_INLINE_ Color operator*(float p_scalar, const Color &p_color) { } } // namespace godot - -#endif // GODOT_COLOR_HPP diff --git a/include/godot_cpp/variant/color_names.inc.hpp b/include/godot_cpp/variant/color_names.inc.hpp index d7708e5d..e2c87832 100644 --- a/include/godot_cpp/variant/color_names.inc.hpp +++ b/include/godot_cpp/variant/color_names.inc.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_COLOR_NAMES_INC_HPP -#define GODOT_COLOR_NAMES_INC_HPP +#pragma once namespace godot { @@ -192,5 +191,3 @@ static NamedColor named_colors[] = { }; } // namespace godot - -#endif // GODOT_COLOR_NAMES_INC_HPP diff --git a/include/godot_cpp/variant/plane.hpp b/include/godot_cpp/variant/plane.hpp index d2184ca4..f2c440a2 100644 --- a/include/godot_cpp/variant/plane.hpp +++ b/include/godot_cpp/variant/plane.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_PLANE_HPP -#define GODOT_PLANE_HPP +#pragma once #include #include @@ -137,5 +136,3 @@ bool Plane::operator!=(const Plane &p_plane) const { } } // namespace godot - -#endif // GODOT_PLANE_HPP diff --git a/include/godot_cpp/variant/projection.hpp b/include/godot_cpp/variant/projection.hpp index cc715778..b7eb1f89 100644 --- a/include/godot_cpp/variant/projection.hpp +++ b/include/godot_cpp/variant/projection.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_PROJECTION_HPP -#define GODOT_PROJECTION_HPP +#pragma once #include #include @@ -167,5 +166,3 @@ Vector3 Projection::xform(const Vector3 &p_vec3) const { } } // namespace godot - -#endif // GODOT_PROJECTION_HPP diff --git a/include/godot_cpp/variant/quaternion.hpp b/include/godot_cpp/variant/quaternion.hpp index 5cf23a35..33569add 100644 --- a/include/godot_cpp/variant/quaternion.hpp +++ b/include/godot_cpp/variant/quaternion.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_QUATERNION_HPP -#define GODOT_QUATERNION_HPP +#pragma once #include #include @@ -232,5 +231,3 @@ _FORCE_INLINE_ Quaternion operator*(real_t p_real, const Quaternion &p_quaternio } } // namespace godot - -#endif // GODOT_QUATERNION_HPP diff --git a/include/godot_cpp/variant/rect2.hpp b/include/godot_cpp/variant/rect2.hpp index 14cbeb51..3a5e18e3 100644 --- a/include/godot_cpp/variant/rect2.hpp +++ b/include/godot_cpp/variant/rect2.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_RECT2_HPP -#define GODOT_RECT2_HPP +#pragma once #include #include @@ -369,5 +368,3 @@ struct [[nodiscard]] Rect2 { }; } // namespace godot - -#endif // GODOT_RECT2_HPP diff --git a/include/godot_cpp/variant/rect2i.hpp b/include/godot_cpp/variant/rect2i.hpp index 2c42aa7f..94c340a8 100644 --- a/include/godot_cpp/variant/rect2i.hpp +++ b/include/godot_cpp/variant/rect2i.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_RECT2I_HPP -#define GODOT_RECT2I_HPP +#pragma once #include #include @@ -241,5 +240,3 @@ struct [[nodiscard]] Rect2i { }; } // namespace godot - -#endif // GODOT_RECT2I_HPP diff --git a/include/godot_cpp/variant/transform2d.hpp b/include/godot_cpp/variant/transform2d.hpp index f83f0399..5135d555 100644 --- a/include/godot_cpp/variant/transform2d.hpp +++ b/include/godot_cpp/variant/transform2d.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_TRANSFORM2D_HPP -#define GODOT_TRANSFORM2D_HPP +#pragma once #include #include @@ -247,5 +246,3 @@ PackedVector2Array Transform2D::xform_inv(const PackedVector2Array &p_array) con } } // namespace godot - -#endif // GODOT_TRANSFORM2D_HPP diff --git a/include/godot_cpp/variant/transform3d.hpp b/include/godot_cpp/variant/transform3d.hpp index 2ad84ff3..b0c1d2e7 100644 --- a/include/godot_cpp/variant/transform3d.hpp +++ b/include/godot_cpp/variant/transform3d.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_TRANSFORM3D_HPP -#define GODOT_TRANSFORM3D_HPP +#pragma once #include #include @@ -272,5 +271,3 @@ _FORCE_INLINE_ Plane Transform3D::xform_inv_fast(const Plane &p_plane, const Tra } } // namespace godot - -#endif // GODOT_TRANSFORM3D_HPP diff --git a/include/godot_cpp/variant/typed_array.hpp b/include/godot_cpp/variant/typed_array.hpp index 36bbcc97..9b735c59 100644 --- a/include/godot_cpp/variant/typed_array.hpp +++ b/include/godot_cpp/variant/typed_array.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_TYPED_ARRAY_HPP -#define GODOT_TYPED_ARRAY_HPP +#pragma once #include #include @@ -138,5 +137,3 @@ MAKE_TYPED_ARRAY(PackedColorArray, Variant::PACKED_COLOR_ARRAY) #undef MAKE_TYPED_ARRAY } // namespace godot - -#endif // GODOT_TYPED_ARRAY_HPP diff --git a/include/godot_cpp/variant/typed_dictionary.hpp b/include/godot_cpp/variant/typed_dictionary.hpp index deb5871a..ff78c516 100644 --- a/include/godot_cpp/variant/typed_dictionary.hpp +++ b/include/godot_cpp/variant/typed_dictionary.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_TYPED_DICTIONARY_HPP -#define GODOT_TYPED_DICTIONARY_HPP +#pragma once #include #include @@ -435,5 +434,3 @@ MAKE_TYPED_DICTIONARY_INFO(IPAddress, Variant::STRING) #undef MAKE_TYPED_DICTIONARY_INFO_WITH_OBJECT } // namespace godot - -#endif // GODOT_TYPED_DICTIONARY_HPP diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp index f6b70523..0e4cda25 100644 --- a/include/godot_cpp/variant/variant.hpp +++ b/include/godot_cpp/variant/variant.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VARIANT_HPP -#define GODOT_VARIANT_HPP +#pragma once #include @@ -367,5 +366,3 @@ using PackedRealArray = PackedFloat32Array; #endif // REAL_T_IS_DOUBLE } // namespace godot - -#endif // GODOT_VARIANT_HPP diff --git a/include/godot_cpp/variant/variant_internal.hpp b/include/godot_cpp/variant/variant_internal.hpp index 623810bb..637e12dd 100644 --- a/include/godot_cpp/variant/variant_internal.hpp +++ b/include/godot_cpp/variant/variant_internal.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VARIANT_INTERNAL_HPP -#define GODOT_VARIANT_INTERNAL_HPP +#pragma once #include #include @@ -505,5 +504,3 @@ struct VariantDefaultInitializer { }; } // namespace godot - -#endif // GODOT_VARIANT_INTERNAL_HPP diff --git a/include/godot_cpp/variant/vector2.hpp b/include/godot_cpp/variant/vector2.hpp index 8252f348..32004f01 100644 --- a/include/godot_cpp/variant/vector2.hpp +++ b/include/godot_cpp/variant/vector2.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VECTOR2_HPP -#define GODOT_VECTOR2_HPP +#pragma once #include #include @@ -330,5 +329,3 @@ typedef Vector2 Size2; typedef Vector2 Point2; } // namespace godot - -#endif // GODOT_VECTOR2_HPP diff --git a/include/godot_cpp/variant/vector2i.hpp b/include/godot_cpp/variant/vector2i.hpp index bee40d5c..73a121a4 100644 --- a/include/godot_cpp/variant/vector2i.hpp +++ b/include/godot_cpp/variant/vector2i.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VECTOR2I_HPP -#define GODOT_VECTOR2I_HPP +#pragma once #include #include @@ -168,5 +167,3 @@ typedef Vector2i Size2i; typedef Vector2i Point2i; } // namespace godot - -#endif // GODOT_VECTOR2I_HPP diff --git a/include/godot_cpp/variant/vector3.hpp b/include/godot_cpp/variant/vector3.hpp index 69d77265..f92d0209 100644 --- a/include/godot_cpp/variant/vector3.hpp +++ b/include/godot_cpp/variant/vector3.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VECTOR3_HPP -#define GODOT_VECTOR3_HPP +#pragma once #include #include @@ -537,5 +536,3 @@ Vector3 Vector3::reflect(const Vector3 &p_normal) const { } } // namespace godot - -#endif // GODOT_VECTOR3_HPP diff --git a/include/godot_cpp/variant/vector3i.hpp b/include/godot_cpp/variant/vector3i.hpp index d489b415..15bc3bde 100644 --- a/include/godot_cpp/variant/vector3i.hpp +++ b/include/godot_cpp/variant/vector3i.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VECTOR3I_HPP -#define GODOT_VECTOR3I_HPP +#pragma once #include #include @@ -339,5 +338,3 @@ void Vector3i::zero() { } } // namespace godot - -#endif // GODOT_VECTOR3I_HPP diff --git a/include/godot_cpp/variant/vector4.hpp b/include/godot_cpp/variant/vector4.hpp index ff95fa7a..1f5ff559 100644 --- a/include/godot_cpp/variant/vector4.hpp +++ b/include/godot_cpp/variant/vector4.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VECTOR4_HPP -#define GODOT_VECTOR4_HPP +#pragma once #include #include @@ -319,5 +318,3 @@ _FORCE_INLINE_ Vector4 operator*(const int64_t p_scalar, const Vector4 &p_vec) { } } // namespace godot - -#endif // GODOT_VECTOR4_HPP diff --git a/include/godot_cpp/variant/vector4i.hpp b/include/godot_cpp/variant/vector4i.hpp index 4325fe99..285feeaf 100644 --- a/include/godot_cpp/variant/vector4i.hpp +++ b/include/godot_cpp/variant/vector4i.hpp @@ -28,8 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef GODOT_VECTOR4I_HPP -#define GODOT_VECTOR4I_HPP +#pragma once #include #include @@ -367,5 +366,3 @@ void Vector4i::zero() { } } // namespace godot - -#endif // GODOT_VECTOR4I_HPP diff --git a/test/src/example.h b/test/src/example.h index 6e6ff399..b40fcab1 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -3,8 +3,7 @@ * This is free and unencumbered software released into the public domain. */ -#ifndef EXAMPLE_CLASS_H -#define EXAMPLE_CLASS_H +#pragma once // We don't need windows.h in this example plugin but many others do, and it can // lead to annoying situations due to the ton of macros it defines. @@ -289,5 +288,3 @@ protected: public: String get_the_word() const; }; - -#endif // EXAMPLE_CLASS_H diff --git a/test/src/register_types.h b/test/src/register_types.h index 5f124da7..d19fd01a 100644 --- a/test/src/register_types.h +++ b/test/src/register_types.h @@ -3,8 +3,7 @@ * This is free and unencumbered software released into the public domain. */ -#ifndef EXAMPLE_REGISTER_TYPES_H -#define EXAMPLE_REGISTER_TYPES_H +#pragma once #include @@ -12,5 +11,3 @@ using namespace godot; void initialize_example_module(ModuleInitializationLevel p_level); void uninitialize_example_module(ModuleInitializationLevel p_level); - -#endif // EXAMPLE_REGISTER_TYPES_H diff --git a/test/src/tests.h b/test/src/tests.h index 55835fc1..a2c39be0 100644 --- a/test/src/tests.h +++ b/test/src/tests.h @@ -3,8 +3,7 @@ * This is free and unencumbered software released into the public domain. */ -#ifndef TESTS_H -#define TESTS_H +#pragma once #include #include @@ -25,5 +24,3 @@ #include #include #include - -#endif // TESTS_H From c963321cdd9e4d357d4424ab6571d35ccf2cbb4c Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Fri, 7 Mar 2025 17:58:27 -0600 Subject: [PATCH 3/3] Ignore `#pragma once` commit --- .git-blame-ignore-revs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..8c434111 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,11 @@ +# This file contains a list of Git commit hashes that should be hidden from the +# regular Git history. Typically, this includes commits involving mass auto-formatting +# or other normalizations. Commit hashes *must* use the full 40-character notation. +# To apply the ignore list in your local Git client, you must run: +# +# git config blame.ignoreRevsFile .git-blame-ignore-revs +# +# This file is automatically used by GitHub.com's blame view. + +# Style: Replace header guards with `#pragma once` +7056c996dd43ae1aa466c94d95cc2fe63853d8a9