diff --git a/examples/main-GLFW_GLES2.cpp b/examples/main-GLFW_GLES2.cpp index 913948427..e9c611fc1 100644 --- a/examples/main-GLFW_GLES2.cpp +++ b/examples/main-GLFW_GLES2.cpp @@ -58,7 +58,7 @@ int main() glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - GLFWwindow* window = glfwCreateWindow(800, 600, "TGUI example (GLFW-GLES2)", NULL, NULL); + GLFWwindow* window = glfwCreateWindow(800, 600, "TGUI example (GLFW-GLES2)", nullptr, nullptr); glfwMakeContextCurrent(window); glfwSwapInterval(1); diff --git a/examples/main-GLFW_OPENGL3.cpp b/examples/main-GLFW_OPENGL3.cpp index dcf35f844..801bf1402 100644 --- a/examples/main-GLFW_OPENGL3.cpp +++ b/examples/main-GLFW_OPENGL3.cpp @@ -59,7 +59,7 @@ int main() glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); // Required for macOS - GLFWwindow* window = glfwCreateWindow(800, 600, "TGUI example (GLFW-OpenGL3)", NULL, NULL); + GLFWwindow* window = glfwCreateWindow(800, 600, "TGUI example (GLFW-OpenGL3)", nullptr, nullptr); glfwMakeContextCurrent(window); glfwSwapInterval(1); diff --git a/include/TGUI/Backend/Window/Backend.hpp b/include/TGUI/Backend/Window/Backend.hpp index 5084df1f3..522516f2f 100644 --- a/include/TGUI/Backend/Window/Backend.hpp +++ b/include/TGUI/Backend/Window/Backend.hpp @@ -53,7 +53,7 @@ namespace tgui /// @brief Checks whether the backend differs from a nullptr /// @return Has setBackend been called with a valid backend? //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - TGUI_API bool isBackendSet(); + [[nodiscard]] TGUI_API bool isBackendSet(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Changes the global backend diff --git a/include/TGUI/Config.hpp.in b/include/TGUI/Config.hpp.in index e9f328b3a..117301425 100644 --- a/include/TGUI/Config.hpp.in +++ b/include/TGUI/Config.hpp.in @@ -131,7 +131,7 @@ // Include the version header when C++20 is available to use the library feature-testing macros #if TGUI_COMPILED_WITH_CPP_VER >= 20 #include -#elif defined(__has_include) +#else // Try including the header even when TGUI itself wasn't compiled with C++20 #if __has_include() #include diff --git a/include/TGUI/Global.hpp b/include/TGUI/Global.hpp index b435be80c..a3be3770f 100644 --- a/include/TGUI/Global.hpp +++ b/include/TGUI/Global.hpp @@ -84,7 +84,7 @@ namespace tgui /// /// @since TGUI 1.13 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - TGUI_API bool getTextInputUsesTextCursorByDefault(); + [[nodiscard]] TGUI_API bool getTextInputUsesTextCursorByDefault(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @brief Sets the default text size for all widgets created after calling the function diff --git a/src/DefaultBackendWindow.cpp b/src/DefaultBackendWindow.cpp index 949c3ae4f..46e90dd1b 100644 --- a/src/DefaultBackendWindow.cpp +++ b/src/DefaultBackendWindow.cpp @@ -64,7 +64,6 @@ namespace tgui { #if TGUI_HAS_BACKEND_SFML_GRAPHICS || TGUI_HAS_BACKEND_SFML_OPENGL3 - class BackendWindowSFML : public DefaultBackendWindow { public: @@ -383,7 +382,6 @@ namespace tgui }; #elif TGUI_HAS_BACKEND_GLFW_OPENGL3 || TGUI_HAS_BACKEND_GLFW_GLES2 - class BackendWindowGLFW : public DefaultBackendWindow { public: @@ -568,7 +566,6 @@ namespace tgui }; #elif TGUI_HAS_BACKEND_RAYLIB - class BackendWindowRaylib : public DefaultBackendWindow { public: @@ -634,8 +631,8 @@ namespace tgui event.type = Event::Type::Closed; return true; } - else // This is the second attempt to close the window (this should not happen), just close it - close(); + // This is the second attempt to close the window (this should not happen), just close it + close(); } } diff --git a/src/FileDialogIconLoaderLinux.cpp b/src/FileDialogIconLoaderLinux.cpp index 8ee858cb8..1d5aafa1c 100644 --- a/src/FileDialogIconLoaderLinux.cpp +++ b/src/FileDialogIconLoaderLinux.cpp @@ -33,11 +33,9 @@ #include #include - #if defined(__has_include) - #if __has_include() - #define TGUI_MAGIC_HEADER_INCLUDED - #include - #endif + #if __has_include() + #define TGUI_MAGIC_HEADER_INCLUDED + #include #endif #if !defined(TGUI_MAGIC_HEADER_INCLUDED) diff --git a/src/FileDialogIconLoaderWindows.cpp b/src/FileDialogIconLoaderWindows.cpp index 7c46b192d..4b5c861d6 100644 --- a/src/FileDialogIconLoaderWindows.cpp +++ b/src/FileDialogIconLoaderWindows.cpp @@ -28,15 +28,13 @@ #include - #if defined(__has_include) - #if __has_include() - #define TGUI_SHELL_API_HEADER_INCLUDED - #include - - // MinGW.org based TDM-GCC doesn't define SHGFI_ADDOVERLAYS - #ifndef SHGFI_ADDOVERLAYS - #define SHGFI_ADDOVERLAYS 0x000000020 - #endif + #if __has_include() + #define TGUI_SHELL_API_HEADER_INCLUDED + #include + + // MinGW.org based TDM-GCC doesn't define SHGFI_ADDOVERLAYS + #ifndef SHGFI_ADDOVERLAYS + #define SHGFI_ADDOVERLAYS 0x000000020 #endif #endif