From 25b2f1780a9c7d7ae5579cc87c89b0c7e2baa14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 13 Jun 2023 16:56:21 +0200 Subject: [PATCH] Style: Harmonize header includes in modules This applies our existing style guide, and adds a new rule to that style guide for modular components such as platform ports and modules: Includes from the platform port or module ("local" includes) should be listed first in their own block using relative paths, before Godot's "core" includes which use "absolute" (project folder relative) paths, and finally thirdparty includes. Includes in `#ifdef`s come after their relevant section, i.e. the overall structure is: - Local includes * Conditional local includes - Core includes * Conditional core includes - Thirdparty includes * Conditional thirdparty includes --- modules/basis_universal/register_types.cpp | 4 +- modules/camera/camera_macos.mm | 1 + modules/csg/csg_shape.h | 4 +- modules/csg/editor/csg_gizmos.h | 1 + modules/cvtt/register_types.cpp | 2 +- modules/denoise/denoise_wrapper.cpp | 4 +- modules/denoise/lightmap_denoiser.cpp | 1 + modules/denoise/register_types.cpp | 4 +- modules/enet/enet_connection.h | 4 +- modules/enet/enet_multiplayer_peer.cpp | 1 + modules/enet/enet_multiplayer_peer.h | 3 +- modules/enet/register_types.cpp | 4 +- modules/etcpak/register_types.h | 2 - modules/gdscript/editor/gdscript_docgen.cpp | 1 + modules/gdscript/editor/gdscript_docgen.h | 1 + .../gdscript/editor/gdscript_highlighter.cpp | 2 + .../gdscript_translation_parser_plugin.cpp | 3 +- .../gdscript_translation_parser_plugin.h | 3 +- modules/gdscript/gdscript.cpp | 28 +++++++----- modules/gdscript/gdscript.h | 3 +- modules/gdscript/gdscript_analyzer.cpp | 5 ++- modules/gdscript/gdscript_analyzer.h | 5 ++- modules/gdscript/gdscript_byte_codegen.cpp | 3 +- modules/gdscript/gdscript_byte_codegen.h | 1 - modules/gdscript/gdscript_cache.cpp | 5 ++- modules/gdscript/gdscript_cache.h | 3 +- modules/gdscript/gdscript_codegen.h | 5 ++- modules/gdscript/gdscript_compiler.h | 3 +- modules/gdscript/gdscript_disassembler.cpp | 4 +- modules/gdscript/gdscript_editor.cpp | 12 +++-- modules/gdscript/gdscript_function.h | 3 +- modules/gdscript/gdscript_lambda_callable.cpp | 3 +- modules/gdscript/gdscript_parser.cpp | 12 +++-- modules/gdscript/gdscript_parser.h | 12 +++-- modules/gdscript/gdscript_tokenizer.cpp | 7 +-- .../gdscript/gdscript_utility_functions.cpp | 3 +- modules/gdscript/gdscript_vm.cpp | 4 +- .../language_server/gdscript_extend_parser.h | 3 +- .../gdscript_language_protocol.h | 7 +-- .../gdscript_language_server.h | 3 +- .../gdscript_text_document.cpp | 5 ++- .../language_server/gdscript_text_document.h | 3 +- .../language_server/gdscript_workspace.cpp | 3 +- .../language_server/gdscript_workspace.h | 5 ++- modules/gdscript/register_types.cpp | 44 ++++++++++++------- modules/gdscript/tests/gdscript_test_runner.h | 1 + .../tests/gdscript_test_runner_suite.h | 1 + modules/gdscript/tests/test_gdscript.cpp | 10 ++--- modules/gdscript/tests/test_gdscript.h | 1 + modules/glslang/register_types.cpp | 4 +- .../editor_scene_exporter_gltf_plugin.cpp | 4 +- .../editor_scene_exporter_gltf_plugin.h | 3 +- .../editor/editor_scene_importer_gltf.cpp | 4 +- .../gltf/extensions/physics/gltf_collider.cpp | 1 + .../gltf/extensions/physics/gltf_collider.h | 1 + .../physics/gltf_document_extension_physics.h | 1 - modules/gltf/register_types.cpp | 5 ++- modules/gltf/structures/gltf_accessor.h | 1 + modules/gltf/structures/gltf_buffer_view.h | 1 + modules/gltf/structures/gltf_mesh.h | 1 + modules/gltf/structures/gltf_node.h | 1 + modules/gltf/structures/gltf_skeleton.cpp | 1 + modules/gltf/structures/gltf_skeleton.h | 1 + modules/gltf/structures/gltf_skin.cpp | 1 + modules/gltf/structures/gltf_skin.h | 1 + modules/gltf/structures/gltf_texture.h | 1 + .../gridmap/editor/grid_map_editor_plugin.h | 1 + modules/gridmap/register_types.cpp | 3 +- modules/jpg/image_loader_jpegd.cpp | 1 + modules/jsonrpc/register_types.cpp | 4 +- modules/lightmapper_rd/lightmapper_rd.cpp | 5 ++- modules/lightmapper_rd/register_types.cpp | 3 +- modules/mbedtls/crypto_mbedtls.cpp | 10 ++--- modules/mbedtls/dtls_server_mbedtls.cpp | 1 + modules/mbedtls/dtls_server_mbedtls.h | 3 +- modules/mbedtls/packet_peer_mbed_dtls.h | 3 +- modules/mbedtls/stream_peer_mbedtls.h | 3 +- modules/mbedtls/tests/test_crypto_mbedtls.cpp | 3 +- modules/mbedtls/tls_context_mbedtls.h | 1 - modules/meshoptimizer/register_types.cpp | 2 + modules/minimp3/audio_stream_mp3.cpp | 1 - modules/minimp3/audio_stream_mp3.h | 2 +- modules/minimp3/register_types.cpp | 5 ++- modules/minimp3/resource_importer_mp3.h | 1 + modules/mono/csharp_script.cpp | 35 ++++++++------- modules/mono/csharp_script.h | 6 +-- modules/mono/editor/bindings_generator.cpp | 10 ++--- modules/mono/editor/bindings_generator.h | 11 ++--- modules/mono/editor/editor_internal_calls.cpp | 19 ++++---- modules/mono/editor/hostfxr_resolver.cpp | 6 +-- modules/mono/glue/runtime_interop.cpp | 15 +++---- modules/mono/godotsharp_dirs.cpp | 14 +++--- modules/mono/managed_callable.h | 4 +- modules/mono/mono_gd/gd_mono.cpp | 25 +++++------ modules/mono/mono_gd/gd_mono.h | 4 +- modules/mono/mono_gd/gd_mono_cache.h | 5 ++- .../mono/mono_gd/support/android_support.cpp | 26 ++++++----- modules/mono/mono_gd/support/ios_support.mm | 6 +-- modules/mono/register_types.cpp | 4 +- modules/mono/signal_awaiter_utils.h | 4 +- modules/mono/utils/path_utils.cpp | 4 +- .../editor/editor_network_profiler.h | 4 +- .../editor/multiplayer_editor_plugin.h | 1 - .../multiplayer/editor/replication_editor.h | 3 +- modules/multiplayer/multiplayer_debugger.h | 1 - modules/multiplayer/multiplayer_spawner.h | 5 +-- .../multiplayer/multiplayer_synchronizer.h | 4 +- modules/multiplayer/register_types.cpp | 3 +- modules/multiplayer/scene_cache_interface.cpp | 4 +- modules/multiplayer/scene_multiplayer.cpp | 4 +- modules/multiplayer/scene_multiplayer.h | 4 +- .../multiplayer/scene_replication_config.h | 1 - .../multiplayer/scene_replication_interface.h | 4 +- modules/multiplayer/scene_rpc_interface.cpp | 4 +- .../editor/navigation_mesh_editor_plugin.cpp | 1 + .../navigation/godot_navigation_server.cpp | 4 +- modules/navigation/godot_navigation_server.h | 10 ++--- modules/navigation/nav_agent.h | 5 ++- modules/navigation/nav_base.h | 1 + modules/navigation/nav_map.cpp | 5 ++- modules/navigation/nav_map.h | 6 +-- modules/navigation/nav_obstacle.h | 3 +- modules/navigation/nav_region.h | 4 +- modules/navigation/register_types.cpp | 6 +-- modules/noise/editor/noise_editor_plugin.cpp | 6 +-- modules/noise/fastnoise_lite.h | 3 +- modules/noise/noise_texture_2d.cpp | 3 +- modules/noise/noise_texture_3d.cpp | 3 +- modules/noise/register_types.cpp | 5 ++- modules/noise/tests/test_fastnoise_lite.h | 4 +- modules/noise/tests/test_noise_texture_2d.h | 4 +- modules/noise/tests/test_noise_texture_3d.h | 4 +- modules/ogg/ogg_packet_sequence.cpp | 1 + modules/openxr/action_map/openxr_action.cpp | 1 + modules/openxr/action_map/openxr_action_map.h | 4 +- modules/openxr/action_map/openxr_action_set.h | 4 +- .../action_map/openxr_interaction_profile.h | 4 +- .../openxr_interaction_profile_meta_data.cpp | 1 + .../openxr_interaction_profile_meta_data.h | 4 +- modules/openxr/editor/openxr_action_editor.h | 1 + .../openxr/editor/openxr_action_map_editor.h | 6 +-- .../editor/openxr_action_set_editor.cpp | 1 + .../openxr/editor/openxr_action_set_editor.h | 1 + .../openxr/editor/openxr_editor_plugin.cpp | 1 + modules/openxr/editor/openxr_editor_plugin.h | 3 +- .../openxr_interaction_profile_editor.cpp | 1 + .../openxr_interaction_profile_editor.h | 4 +- .../editor/openxr_select_action_dialog.cpp | 1 - .../editor/openxr_select_action_dialog.h | 1 + ...openxr_select_interaction_profile_dialog.h | 1 + .../extensions/openxr_android_extension.cpp | 4 +- .../openxr_composition_layer_provider.h | 1 + .../extensions/openxr_extension_wrapper.h | 1 + ...openxr_fb_display_refresh_rate_extension.h | 1 - .../openxr_fb_passthrough_extension_wrapper.h | 1 - .../openxr_hand_tracking_extension.cpp | 2 + .../openxr_hand_tracking_extension.h | 3 +- .../openxr_htc_controller_extension.cpp | 1 + .../openxr_htc_vive_tracker_extension.cpp | 2 + .../openxr_huawei_controller_extension.cpp | 1 + .../openxr_ml2_controller_extension.cpp | 1 + .../extensions/openxr_opengl_extension.cpp | 4 +- .../extensions/openxr_opengl_extension.h | 9 ++-- .../extensions/openxr_palm_pose_extension.cpp | 1 + .../openxr_pico_controller_extension.cpp | 1 + .../extensions/openxr_vulkan_extension.cpp | 5 ++- .../extensions/openxr_vulkan_extension.h | 13 +++--- .../openxr_wmr_controller_extension.cpp | 1 + modules/openxr/openxr_api.cpp | 11 ++--- modules/openxr/openxr_api.h | 13 +++--- modules/openxr/openxr_interface.h | 7 ++- modules/openxr/openxr_util.cpp | 1 + modules/openxr/openxr_util.h | 1 + modules/openxr/register_types.cpp | 30 +++++++------ modules/openxr/scene/openxr_hand.cpp | 3 +- modules/openxr/scene/openxr_hand.h | 2 + modules/raycast/raycast_occlusion_cull.cpp | 1 + modules/raycast/static_raycaster_embree.cpp | 4 +- modules/regex/regex.cpp | 1 + modules/regex/regex.h | 2 +- modules/regex/register_types.cpp | 4 +- modules/regex/tests/test_regex.h | 3 +- .../text_server_adv/icu_data/icudata_stub.cpp | 6 +-- modules/text_server_adv/text_server_adv.cpp | 8 ++-- modules/text_server_adv/text_server_adv.h | 7 ++- modules/text_server_adv/thorvg_svg_in_ot.cpp | 3 +- modules/text_server_fb/text_server_fb.cpp | 8 ++-- modules/text_server_fb/text_server_fb.h | 3 +- modules/text_server_fb/thorvg_svg_in_ot.cpp | 3 +- modules/tinyexr/image_saver_tinyexr.cpp | 1 + modules/upnp/register_types.cpp | 4 +- modules/upnp/upnp.h | 4 +- modules/vhacd/register_types.cpp | 2 + .../vorbis/resource_importer_ogg_vorbis.cpp | 6 +-- modules/vorbis/resource_importer_ogg_vorbis.h | 1 + modules/webp/image_loader_webp.cpp | 6 ++- modules/webp/resource_saver_webp.cpp | 3 +- modules/webp/webp_common.cpp | 3 +- modules/webrtc/register_types.cpp | 7 +-- modules/webrtc/webrtc_data_channel.cpp | 1 + modules/webrtc/webrtc_data_channel_js.cpp | 6 +-- modules/webrtc/webrtc_multiplayer_peer.h | 3 +- modules/webrtc/webrtc_peer_connection.h | 3 +- modules/webrtc/webrtc_peer_connection_js.cpp | 6 +-- .../editor_debugger_server_websocket.cpp | 1 + modules/websocket/emws_peer.cpp | 4 +- modules/websocket/emws_peer.h | 8 ++-- modules/websocket/register_types.cpp | 16 ++++--- .../remote_debugger_peer_websocket.h | 4 +- .../websocket/websocket_multiplayer_peer.h | 3 +- modules/websocket/wsl_peer.cpp | 6 +-- modules/websocket/wsl_peer.h | 6 +-- modules/webxr/godot_webxr.h | 2 +- modules/webxr/webxr_interface.cpp | 1 + modules/webxr/webxr_interface_js.cpp | 7 +-- modules/xatlas_unwrap/register_types.cpp | 4 +- modules/zip/register_types.cpp | 3 +- 217 files changed, 572 insertions(+), 415 deletions(-) diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index f7bdaf389ed..3eb0dc96311 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -33,12 +33,12 @@ #include "core/os/os.h" #include "servers/rendering_server.h" +#include + #ifdef TOOLS_ENABLED #include #endif -#include - enum BasisDecompressFormat { BASIS_DECOMPRESS_RG, BASIS_DECOMPRESS_RGB, diff --git a/modules/camera/camera_macos.mm b/modules/camera/camera_macos.mm index eca8adbfcfa..c0d8dc2cef2 100644 --- a/modules/camera/camera_macos.mm +++ b/modules/camera/camera_macos.mm @@ -32,6 +32,7 @@ // If you fix something here, make sure you fix it there as well! #include "camera_macos.h" + #include "servers/camera/camera_feed.h" #import diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index d0e4d0c8cd1..6ac71b69460 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -31,12 +31,12 @@ #ifndef CSG_SHAPE_H #define CSG_SHAPE_H -#define CSGJS_HEADER_ONLY - #include "csg.h" + #include "scene/3d/path_3d.h" #include "scene/3d/visual_instance_3d.h" #include "scene/resources/concave_polygon_shape_3d.h" + #include "thirdparty/misc/mikktspace.h" class CSGShape3D : public GeometryInstance3D { diff --git a/modules/csg/editor/csg_gizmos.h b/modules/csg/editor/csg_gizmos.h index 89a43056831..deac1d428d0 100644 --- a/modules/csg/editor/csg_gizmos.h +++ b/modules/csg/editor/csg_gizmos.h @@ -34,6 +34,7 @@ #ifdef TOOLS_ENABLED #include "../csg_shape.h" + #include "editor/editor_plugin.h" #include "editor/plugins/node_3d_editor_gizmos.h" diff --git a/modules/cvtt/register_types.cpp b/modules/cvtt/register_types.cpp index c22aedb0fc3..211d419349f 100644 --- a/modules/cvtt/register_types.cpp +++ b/modules/cvtt/register_types.cpp @@ -49,4 +49,4 @@ void uninitialize_cvtt_module(ModuleInitializationLevel p_level) { } } -#endif +#endif // TOOLS_ENABLED diff --git a/modules/denoise/denoise_wrapper.cpp b/modules/denoise/denoise_wrapper.cpp index 9effb602023..87f02cb4c6c 100644 --- a/modules/denoise/denoise_wrapper.cpp +++ b/modules/denoise/denoise_wrapper.cpp @@ -29,7 +29,9 @@ /**************************************************************************/ #include "denoise_wrapper.h" -#include "thirdparty/oidn/include/OpenImageDenoise/oidn.h" + +#include + #include void *oidn_denoiser_init() { diff --git a/modules/denoise/lightmap_denoiser.cpp b/modules/denoise/lightmap_denoiser.cpp index 8419b7e52ae..72764036e12 100644 --- a/modules/denoise/lightmap_denoiser.cpp +++ b/modules/denoise/lightmap_denoiser.cpp @@ -29,6 +29,7 @@ /**************************************************************************/ #include "lightmap_denoiser.h" + #include "denoise_wrapper.h" #include "core/io/image.h" diff --git a/modules/denoise/register_types.cpp b/modules/denoise/register_types.cpp index 9448776529b..a4264b07c53 100644 --- a/modules/denoise/register_types.cpp +++ b/modules/denoise/register_types.cpp @@ -29,9 +29,11 @@ /**************************************************************************/ #include "register_types.h" -#include "core/config/engine.h" + #include "lightmap_denoiser.h" +#include "core/config/engine.h" + void initialize_denoise_module(ModuleInitializationLevel p_level) { if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { return; diff --git a/modules/enet/enet_connection.h b/modules/enet/enet_connection.h index ee0cd831deb..616402be203 100644 --- a/modules/enet/enet_connection.h +++ b/modules/enet/enet_connection.h @@ -31,10 +31,10 @@ #ifndef ENET_CONNECTION_H #define ENET_CONNECTION_H -#include "core/object/ref_counted.h" +#include "enet_packet_peer.h" #include "core/crypto/crypto.h" -#include "enet_packet_peer.h" +#include "core/object/ref_counted.h" #include diff --git a/modules/enet/enet_multiplayer_peer.cpp b/modules/enet/enet_multiplayer_peer.cpp index 93a20ab1f8c..af5bd2929c3 100644 --- a/modules/enet/enet_multiplayer_peer.cpp +++ b/modules/enet/enet_multiplayer_peer.cpp @@ -29,6 +29,7 @@ /**************************************************************************/ #include "enet_multiplayer_peer.h" + #include "core/io/ip.h" #include "core/io/marshalls.h" #include "core/os/os.h" diff --git a/modules/enet/enet_multiplayer_peer.h b/modules/enet/enet_multiplayer_peer.h index f0d157cbf86..930af2d8cb7 100644 --- a/modules/enet/enet_multiplayer_peer.h +++ b/modules/enet/enet_multiplayer_peer.h @@ -31,10 +31,11 @@ #ifndef ENET_MULTIPLAYER_PEER_H #define ENET_MULTIPLAYER_PEER_H +#include "enet_connection.h" + #include "core/crypto/crypto.h" #include "scene/main/multiplayer_peer.h" -#include "enet_connection.h" #include class ENetMultiplayerPeer : public MultiplayerPeer { diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp index 9c287a4f403..5787f9c2dad 100644 --- a/modules/enet/register_types.cpp +++ b/modules/enet/register_types.cpp @@ -29,11 +29,13 @@ /**************************************************************************/ #include "register_types.h" -#include "core/error/error_macros.h" + #include "enet_connection.h" #include "enet_multiplayer_peer.h" #include "enet_packet_peer.h" +#include "core/error/error_macros.h" + static bool enet_ok = false; void initialize_enet_module(ModuleInitializationLevel p_level) { diff --git a/modules/etcpak/register_types.h b/modules/etcpak/register_types.h index 2580ae2f97e..4967f3c3f5d 100644 --- a/modules/etcpak/register_types.h +++ b/modules/etcpak/register_types.h @@ -33,8 +33,6 @@ #include "modules/register_module_types.h" -#include "modules/register_module_types.h" - void initialize_etcpak_module(ModuleInitializationLevel p_level); void uninitialize_etcpak_module(ModuleInitializationLevel p_level); diff --git a/modules/gdscript/editor/gdscript_docgen.cpp b/modules/gdscript/editor/gdscript_docgen.cpp index ce64d797477..df17581ad14 100644 --- a/modules/gdscript/editor/gdscript_docgen.cpp +++ b/modules/gdscript/editor/gdscript_docgen.cpp @@ -29,6 +29,7 @@ /**************************************************************************/ #include "gdscript_docgen.h" + #include "../gdscript.h" using GDP = GDScriptParser; diff --git a/modules/gdscript/editor/gdscript_docgen.h b/modules/gdscript/editor/gdscript_docgen.h index bb3647196ab..3357fb680c4 100644 --- a/modules/gdscript/editor/gdscript_docgen.h +++ b/modules/gdscript/editor/gdscript_docgen.h @@ -32,6 +32,7 @@ #define GDSCRIPT_DOCGEN_H #include "../gdscript_parser.h" + #include "core/doc_data.h" class GDScriptDocGen { diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index bba11363d55..b54dc502ae3 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -29,8 +29,10 @@ /**************************************************************************/ #include "gdscript_highlighter.h" + #include "../gdscript.h" #include "../gdscript_tokenizer.h" + #include "core/config/project_settings.h" #include "editor/editor_settings.h" diff --git a/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp b/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp index 3458eb43b5a..e17e748d7b9 100644 --- a/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp +++ b/modules/gdscript/editor/gdscript_translation_parser_plugin.cpp @@ -30,8 +30,9 @@ #include "gdscript_translation_parser_plugin.h" +#include "../gdscript.h" + #include "core/io/resource_loader.h" -#include "modules/gdscript/gdscript.h" void GDScriptEditorTranslationParserPlugin::get_recognized_extensions(List *r_extensions) const { GDScriptLanguage::get_singleton()->get_recognized_extensions(r_extensions); diff --git a/modules/gdscript/editor/gdscript_translation_parser_plugin.h b/modules/gdscript/editor/gdscript_translation_parser_plugin.h index 7e6e381e3fa..421030e49af 100644 --- a/modules/gdscript/editor/gdscript_translation_parser_plugin.h +++ b/modules/gdscript/editor/gdscript_translation_parser_plugin.h @@ -31,9 +31,10 @@ #ifndef GDSCRIPT_TRANSLATION_PARSER_PLUGIN_H #define GDSCRIPT_TRANSLATION_PARSER_PLUGIN_H +#include "../gdscript_parser.h" + #include "core/templates/hash_set.h" #include "editor/editor_translation_parser.h" -#include "modules/gdscript/gdscript_parser.h" class GDScriptEditorTranslationParserPlugin : public EditorTranslationParserPlugin { GDCLASS(GDScriptEditorTranslationParserPlugin, EditorTranslationParserPlugin); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 945dfc98624..c3547e3db7d 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -30,7 +30,20 @@ #include "gdscript.h" -#include +#include "gdscript_analyzer.h" +#include "gdscript_cache.h" +#include "gdscript_compiler.h" +#include "gdscript_parser.h" +#include "gdscript_rpc_callable.h" +#include "gdscript_warning.h" + +#ifdef TOOLS_ENABLED +#include "editor/gdscript_docgen.h" +#endif + +#ifdef TESTS_ENABLED +#include "tests/gdscript_test_runner.h" +#endif #include "core/config/engine.h" #include "core/config/project_settings.h" @@ -39,22 +52,13 @@ #include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" #include "core/os/os.h" -#include "gdscript_analyzer.h" -#include "gdscript_cache.h" -#include "gdscript_compiler.h" -#include "gdscript_parser.h" -#include "gdscript_rpc_callable.h" -#include "gdscript_warning.h" - -#ifdef TESTS_ENABLED -#include "tests/gdscript_test_runner.h" -#endif #ifdef TOOLS_ENABLED #include "editor/editor_paths.h" -#include "editor/gdscript_docgen.h" #endif +#include + /////////////////////////// GDScriptNativeClass::GDScriptNativeClass(const StringName &p_name) { diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 60bd9eef536..1d6ff6406ae 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -31,6 +31,8 @@ #ifndef GDSCRIPT_H #define GDSCRIPT_H +#include "gdscript_function.h" + #include "core/debugger/engine_debugger.h" #include "core/debugger/script_debugger.h" #include "core/doc_data.h" @@ -38,7 +40,6 @@ #include "core/io/resource_saver.h" #include "core/object/script_language.h" #include "core/templates/rb_set.h" -#include "gdscript_function.h" class GDScriptNativeClass : public RefCounted { GDCLASS(GDScriptNativeClass, RefCounted); diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 8251de2956b..2c96aac99d5 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -30,6 +30,9 @@ #include "gdscript_analyzer.h" +#include "gdscript.h" +#include "gdscript_utility_functions.h" + #include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/core_constants.h" @@ -39,8 +42,6 @@ #include "core/object/class_db.h" #include "core/object/script_language.h" #include "core/templates/hash_map.h" -#include "gdscript.h" -#include "gdscript_utility_functions.h" #include "scene/resources/packed_scene.h" #if defined(TOOLS_ENABLED) && !defined(DISABLE_DEPRECATED) diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h index 0c7bf4125b4..6a80fc272d6 100644 --- a/modules/gdscript/gdscript_analyzer.h +++ b/modules/gdscript/gdscript_analyzer.h @@ -31,11 +31,12 @@ #ifndef GDSCRIPT_ANALYZER_H #define GDSCRIPT_ANALYZER_H +#include "gdscript_cache.h" +#include "gdscript_parser.h" + #include "core/object/object.h" #include "core/object/ref_counted.h" #include "core/templates/hash_set.h" -#include "gdscript_cache.h" -#include "gdscript_parser.h" class GDScriptAnalyzer { GDScriptParser *parser = nullptr; diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index 1414075ba85..3239f64cb2a 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -30,9 +30,10 @@ #include "gdscript_byte_codegen.h" -#include "core/debugger/engine_debugger.h" #include "gdscript.h" +#include "core/debugger/engine_debugger.h" + uint32_t GDScriptByteCodeGenerator::add_parameter(const StringName &p_name, bool p_is_optional, const GDScriptDataType &p_type) { #ifdef TOOLS_ENABLED function->arg_names.push_back(p_name); diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h index fc684e4d8f7..bed5cc24053 100644 --- a/modules/gdscript/gdscript_byte_codegen.h +++ b/modules/gdscript/gdscript_byte_codegen.h @@ -32,7 +32,6 @@ #define GDSCRIPT_BYTE_CODEGEN_H #include "gdscript_codegen.h" - #include "gdscript_function.h" #include "gdscript_utility_functions.h" diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index 126fccbbf0e..79f26e529c3 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -30,12 +30,13 @@ #include "gdscript_cache.h" -#include "core/io/file_access.h" -#include "core/templates/vector.h" #include "gdscript.h" #include "gdscript_analyzer.h" #include "gdscript_compiler.h" #include "gdscript_parser.h" + +#include "core/io/file_access.h" +#include "core/templates/vector.h" #include "scene/resources/packed_scene.h" bool GDScriptParserRef::is_valid() const { diff --git a/modules/gdscript/gdscript_cache.h b/modules/gdscript/gdscript_cache.h index 28266a1c0ba..0a0f403e44b 100644 --- a/modules/gdscript/gdscript_cache.h +++ b/modules/gdscript/gdscript_cache.h @@ -31,11 +31,12 @@ #ifndef GDSCRIPT_CACHE_H #define GDSCRIPT_CACHE_H +#include "gdscript.h" + #include "core/object/ref_counted.h" #include "core/os/mutex.h" #include "core/templates/hash_map.h" #include "core/templates/hash_set.h" -#include "gdscript.h" #include "scene/resources/packed_scene.h" class GDScriptAnalyzer; diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h index dbc24663932..fa1732d58f0 100644 --- a/modules/gdscript/gdscript_codegen.h +++ b/modules/gdscript/gdscript_codegen.h @@ -31,11 +31,12 @@ #ifndef GDSCRIPT_CODEGEN_H #define GDSCRIPT_CODEGEN_H -#include "core/string/string_name.h" -#include "core/variant/variant.h" #include "gdscript_function.h" #include "gdscript_utility_functions.h" +#include "core/string/string_name.h" +#include "core/variant/variant.h" + class GDScriptCodeGenerator { public: struct Address { diff --git a/modules/gdscript/gdscript_compiler.h b/modules/gdscript/gdscript_compiler.h index 2d15d461fb2..494eef41d92 100644 --- a/modules/gdscript/gdscript_compiler.h +++ b/modules/gdscript/gdscript_compiler.h @@ -31,12 +31,13 @@ #ifndef GDSCRIPT_COMPILER_H #define GDSCRIPT_COMPILER_H -#include "core/templates/hash_set.h" #include "gdscript.h" #include "gdscript_codegen.h" #include "gdscript_function.h" #include "gdscript_parser.h" +#include "core/templates/hash_set.h" + class GDScriptCompiler { const GDScriptParser *parser = nullptr; HashSet parsed_classes; diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp index 45ad8792d99..cf33f12e3ae 100644 --- a/modules/gdscript/gdscript_disassembler.cpp +++ b/modules/gdscript/gdscript_disassembler.cpp @@ -30,10 +30,10 @@ #ifdef DEBUG_ENABLED +#include "gdscript.h" #include "gdscript_function.h" #include "core/string/string_builder.h" -#include "gdscript.h" static String _get_variant_string(const Variant &p_variant) { String txt; @@ -1130,4 +1130,4 @@ void GDScriptFunction::disassemble(const Vector &p_code_lines) const { } } -#endif +#endif // DEBUG_ENABLED diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 09af51656cf..07122ed594c 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -30,20 +30,24 @@ #include "gdscript.h" -#include "core/config/engine.h" -#include "core/core_constants.h" -#include "core/io/file_access.h" #include "gdscript_analyzer.h" #include "gdscript_compiler.h" #include "gdscript_parser.h" #include "gdscript_tokenizer.h" #include "gdscript_utility_functions.h" +#ifdef TOOLS_ENABLED +#include "editor/script_templates/templates.gen.h" +#endif + +#include "core/config/engine.h" +#include "core/core_constants.h" +#include "core/io/file_access.h" + #ifdef TOOLS_ENABLED #include "core/config/project_settings.h" #include "editor/editor_file_system.h" #include "editor/editor_settings.h" -#include "editor/script_templates/templates.gen.h" #endif void GDScriptLanguage::get_comment_delimiters(List *p_delimiters) const { diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index 390e562e6fc..b6f3e7cc876 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -31,6 +31,8 @@ #ifndef GDSCRIPT_FUNCTION_H #define GDSCRIPT_FUNCTION_H +#include "gdscript_utility_functions.h" + #include "core/object/ref_counted.h" #include "core/object/script_language.h" #include "core/os/thread.h" @@ -38,7 +40,6 @@ #include "core/templates/pair.h" #include "core/templates/self_list.h" #include "core/variant/variant.h" -#include "gdscript_utility_functions.h" class GDScriptInstance; class GDScript; diff --git a/modules/gdscript/gdscript_lambda_callable.cpp b/modules/gdscript/gdscript_lambda_callable.cpp index e9fe17bb170..9e14e43a58a 100644 --- a/modules/gdscript/gdscript_lambda_callable.cpp +++ b/modules/gdscript/gdscript_lambda_callable.cpp @@ -30,9 +30,10 @@ #include "gdscript_lambda_callable.h" -#include "core/templates/hashfuncs.h" #include "gdscript.h" +#include "core/templates/hashfuncs.h" + bool GDScriptLambdaCallable::compare_equal(const CallableCustom *p_a, const CallableCustom *p_b) { // Lambda callables are only compared by reference. return p_a == p_b; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index d90503c6587..de8a5c66f4f 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -30,23 +30,27 @@ #include "gdscript_parser.h" +#include "gdscript.h" + +#ifdef DEBUG_ENABLED +#include "gdscript_warning.h" +#endif + #include "core/config/project_settings.h" #include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/math/math_defs.h" -#include "gdscript.h" #include "scene/main/multiplayer_api.h" #ifdef DEBUG_ENABLED #include "core/os/os.h" #include "core/string/string_builder.h" -#include "gdscript_warning.h" #include "servers/text_server.h" -#endif // DEBUG_ENABLED +#endif #ifdef TOOLS_ENABLED #include "editor/editor_settings.h" -#endif // TOOLS_ENABLED +#endif static HashMap builtin_types; Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) { diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 8f0265510f7..ad08c3bfd6b 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -31,6 +31,13 @@ #ifndef GDSCRIPT_PARSER_H #define GDSCRIPT_PARSER_H +#include "gdscript_cache.h" +#include "gdscript_tokenizer.h" + +#ifdef DEBUG_ENABLED +#include "gdscript_warning.h" +#endif + #include "core/io/resource.h" #include "core/object/ref_counted.h" #include "core/object/script_language.h" @@ -41,13 +48,10 @@ #include "core/templates/rb_map.h" #include "core/templates/vector.h" #include "core/variant/variant.h" -#include "gdscript_cache.h" -#include "gdscript_tokenizer.h" #ifdef DEBUG_ENABLED #include "core/string/string_builder.h" -#include "gdscript_warning.h" -#endif // DEBUG_ENABLED +#endif class GDScriptParser { struct AnnotationInfo; diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index a45a73a8d51..c77783e5a32 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -33,13 +33,14 @@ #include "core/error/error_macros.h" #include "core/string/char_utils.h" -#ifdef TOOLS_ENABLED -#include "editor/editor_settings.h" -#endif #ifdef DEBUG_ENABLED #include "servers/text_server.h" #endif +#ifdef TOOLS_ENABLED +#include "editor/editor_settings.h" +#endif + static const char *token_names[] = { "Empty", // EMPTY, // Basic diff --git a/modules/gdscript/gdscript_utility_functions.cpp b/modules/gdscript/gdscript_utility_functions.cpp index 8862450121b..030950267de 100644 --- a/modules/gdscript/gdscript_utility_functions.cpp +++ b/modules/gdscript/gdscript_utility_functions.cpp @@ -30,6 +30,8 @@ #include "gdscript_utility_functions.h" +#include "gdscript.h" + #include "core/io/resource_loader.h" #include "core/object/class_db.h" #include "core/object/method_bind.h" @@ -37,7 +39,6 @@ #include "core/templates/oa_hash_map.h" #include "core/templates/vector.h" #include "core/variant/typed_array.h" -#include "gdscript.h" #ifdef DEBUG_ENABLED diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index bebf34cbb3c..0ffc025c247 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ +#include "gdscript.h" #include "gdscript_function.h" +#include "gdscript_lambda_callable.h" #include "core/core_string_names.h" #include "core/os/os.h" -#include "gdscript.h" -#include "gdscript_lambda_callable.h" #ifdef DEBUG_ENABLED static String _get_script_name(const Ref