| @@ -0,0 +1,47 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net> | |||||
| // | |||||
| // Lol Engine is free software. It comes without any warranty, to | |||||
| // the extent permitted by applicable law. You can redistribute it | |||||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||||
| // See http://www.wtfpl.net/ for more details. | |||||
| // | |||||
| #pragma once | |||||
| // | |||||
| // The build-time features | |||||
| // ——————————————————————— | |||||
| // | |||||
| // C++ compiler features detected through __has_cpp_attribute | |||||
| #if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) | |||||
| # define LOL_ATTR_NODISCARD [[nodiscard]] | |||||
| #else | |||||
| # define LOL_ATTR_NODISCARD /* */ | |||||
| #endif | |||||
| #if defined(__has_cpp_attribute) && __has_cpp_attribute(fallthrough) | |||||
| # define LOL_ATTR_FALLTHROUGH [[fallthrough]]; | |||||
| #else | |||||
| # define LOL_ATTR_FALLTHROUGH /* */ | |||||
| #endif | |||||
| // Define some attribute macros. | |||||
| #ifdef __GNUC__ | |||||
| # define LOL_ATTR_FORMAT(n, p) __attribute__((format(printf, n, p))) | |||||
| #else | |||||
| # define LOL_ATTR_FORMAT(n, p) | |||||
| #endif | |||||
| #if defined(_WIN32) | |||||
| # define LOL_ATTR_STDCALL __stdcall | |||||
| #else | |||||
| # define LOL_ATTR_STDCALL /* */ | |||||
| #endif | |||||
| @@ -19,6 +19,8 @@ | |||||
| // Contains some utilities to work with std::string objects. | // Contains some utilities to work with std::string objects. | ||||
| // | // | ||||
| #include <lol/base/features.h> | |||||
| #include <vector> | #include <vector> | ||||
| #include <string> | #include <string> | ||||
| #include <algorithm> // std::transform | #include <algorithm> // std::transform | ||||
| @@ -14,9 +14,11 @@ | |||||
| // | // | ||||
| // The Real class | // The Real class | ||||
| // -------------- | |||||
| // —————————————— | |||||
| // | // | ||||
| #include <lol/base/features.h> | |||||
| #include <vector> | #include <vector> | ||||
| #include <string> | #include <string> | ||||
| #include <cstdint> | #include <cstdint> | ||||
| @@ -28,19 +28,6 @@ | |||||
| #undef LOL_FEATURE_CXX11_TEMPLATE_ALIASES | #undef LOL_FEATURE_CXX11_TEMPLATE_ALIASES | ||||
| #undef LOL_FEATURE_CXX11_SFINAE_FOR_CTORS | #undef LOL_FEATURE_CXX11_SFINAE_FOR_CTORS | ||||
| #undef LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD | |||||
| #undef LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH | |||||
| /* Features detected through __has_cpp_attribute */ | |||||
| #ifdef __has_cpp_attribute | |||||
| # if __has_cpp_attribute(nodiscard) | |||||
| # define LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD 1 | |||||
| # endif | |||||
| # if __has_cpp_attribute(fallthrough) | |||||
| # define LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH 1 | |||||
| # endif | |||||
| #endif | |||||
| /* Features supported by GCC */ | /* Features supported by GCC */ | ||||
| #if defined __GNUC__ | #if defined __GNUC__ | ||||
| # if !defined(__GXX_EXPERIMENTAL_CXX0X) && __cplusplus < 201103L | # if !defined(__GXX_EXPERIMENTAL_CXX0X) && __cplusplus < 201103L | ||||
| @@ -82,35 +69,6 @@ | |||||
| #endif | #endif | ||||
| /* | |||||
| * Define some attribute macros. | |||||
| */ | |||||
| #ifdef __GNUC__ | |||||
| # define LOL_ATTR_FORMAT(n, p) __attribute__((format(printf, n, p))) | |||||
| #else | |||||
| # define LOL_ATTR_FORMAT(n, p) | |||||
| #endif | |||||
| #if defined(_WIN32) | |||||
| # define LOL_ATTR_STDCALL __stdcall | |||||
| #else | |||||
| # define LOL_ATTR_STDCALL /* */ | |||||
| #endif | |||||
| #ifdef LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD | |||||
| # define LOL_ATTR_NODISCARD [[nodiscard]] | |||||
| #else | |||||
| # define LOL_ATTR_NODISCARD /* */ | |||||
| #endif | |||||
| #ifdef LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH | |||||
| # define LOL_ATTR_FALLTHROUGH [[fallthrough]]; | |||||
| #else | |||||
| # define LOL_ATTR_FALLTHROUGH /* */ | |||||
| #endif | |||||
| /* | /* | ||||
| * Ensure we have ptrdiff_t. | * Ensure we have ptrdiff_t. | ||||
| */ | */ | ||||