From 6def32d643b9be6dba8f5e355e3dd75d82814bed Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 24 Sep 2021 01:19:49 +0200 Subject: [PATCH] Replace `#pragma once` by traditional include guards for consistency `#pragma once` was used in a few files, yet we settled on using traditional include guards instead. The PooledList template comment was also moved to allow editors such as Visual Studio Code to display the comment when hovering PooledList. `app.h` was renamed to `app_uwp.h` to be less generic for the include guard. --- core/templates/pooled_list.h | 14 ++++++++------ platform/uwp/SCsub | 2 +- platform/uwp/{app.cpp => app_uwp.cpp} | 4 ++-- platform/uwp/{app.h => app_uwp.h} | 6 ++++-- 4 files changed, 15 insertions(+), 11 deletions(-) rename platform/uwp/{app.cpp => app_uwp.cpp} (99%) rename platform/uwp/{app.h => app_uwp.h} (97%) diff --git a/core/templates/pooled_list.h b/core/templates/pooled_list.h index b4a6d2d1dde..b139dadb756 100644 --- a/core/templates/pooled_list.h +++ b/core/templates/pooled_list.h @@ -28,13 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#pragma once +#ifndef POOLED_LIST_H +#define POOLED_LIST_H + +#include "core/templates/local_vector.h" // Simple template to provide a pool with O(1) allocate and free. // The freelist could alternatively be a linked list placed within the unused elements // to use less memory, however a separate freelist is probably more cache friendly. - -// NOTE : Take great care when using this with non POD types. The construction and destruction +// +// NOTE: Take great care when using this with non POD types. The construction and destruction // is done in the LocalVector, NOT as part of the pool. So requesting a new item does not guarantee // a constructor is run, and free does not guarantee a destructor. // You should generally handle clearing @@ -42,9 +45,6 @@ // This is by design for fastest use in the BVH. If you want a more general pool // that does call constructors / destructors on request / free, this should probably be // a separate template. - -#include "core/templates/local_vector.h" - template class PooledList { LocalVector list; @@ -93,3 +93,5 @@ public: _used_size--; } }; + +#endif // POOLED_LIST_H diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub index 71c402358f4..8726d32d617 100644 --- a/platform/uwp/SCsub +++ b/platform/uwp/SCsub @@ -7,7 +7,7 @@ files = [ "#platform/windows/windows_terminal_logger.cpp", "joypad_uwp.cpp", "context_egl_uwp.cpp", - "app.cpp", + "app_uwp.cpp", "os_uwp.cpp", ] diff --git a/platform/uwp/app.cpp b/platform/uwp/app_uwp.cpp similarity index 99% rename from platform/uwp/app.cpp rename to platform/uwp/app_uwp.cpp index 1da17ffc5d0..50e33e6c499 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app_uwp.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* app.cpp */ +/* app_uwp.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -32,7 +32,7 @@ // This file demonstrates how to initialize EGL in a Windows Store app, using ICoreWindow. // -#include "app.h" +#include "app_uwp.h" #include "core/io/dir_access.h" #include "core/io/file_access.h" diff --git a/platform/uwp/app.h b/platform/uwp/app_uwp.h similarity index 97% rename from platform/uwp/app.h rename to platform/uwp/app_uwp.h index 0b02527dae7..8d4a0b90c3f 100644 --- a/platform/uwp/app.h +++ b/platform/uwp/app_uwp.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* app.h */ +/* app_uwp.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#pragma once +#ifndef APP_UWP_H +#define APP_UWP_H #include @@ -111,3 +112,4 @@ namespace GodotUWP } /* clang-format on */ +#endif // APP_UWP_H