diff --git a/include/mettle/detail/source_location.hpp b/include/mettle/detail/source_location.hpp index 15d0153..dd4abb5 100644 --- a/include/mettle/detail/source_location.hpp +++ b/include/mettle/detail/source_location.hpp @@ -1,37 +1,34 @@ #ifndef INC_METTLE_DETAIL_SOURCE_LOCATION_HPP #define INC_METTLE_DETAIL_SOURCE_LOCATION_HPP -#include +#include // Try to use `std::source_location`, except on Clang 15, where it's broken. // See . -#if __has_include() && \ +#if defined(__cpp_lib_source_location) && \ + __has_include() && \ (!defined(__clang__) || __clang_major__ >= 16) # include -# ifdef __cpp_lib_source_location -# define METTLE_FOUND_SOURCE_LOCATION + namespace mettle::detail { using source_location = std::source_location; } -# endif -#endif -#if !defined(METTLE_FOUND_SOURCE_LOCATION) && \ - __has_include() +#elif !defined(METTLE_FOUND_SOURCE_LOCATION) && \ + __has_include() # include -# define METTLE_FOUND_SOURCE_LOCATION + namespace mettle::detail { using source_location = std::experimental::source_location; } -#endif -#ifndef METTLE_FOUND_SOURCE_LOCATION +#else # include "source_location_shim.hpp" + namespace mettle::detail { using source_location = source_location_shim; } -#endif -#undef METTLE_FOUND_SOURCE_LOCATION +#endif #endif