17#ifndef MICRO_TEST_PLUS_REFLECTION_H_
18#define MICRO_TEST_PLUS_REFLECTION_H_
28#if defined(__cpp_lib_source_location)
29#include <source_location>
35#pragma GCC diagnostic push
36#pragma GCC diagnostic ignored "-Wpadded"
37#pragma GCC diagnostic ignored "-Waggregate-return"
39#pragma clang diagnostic ignored "-Wc++98-compat"
40#pragma clang diagnostic ignored "-Wunknown-warning-option"
50#if defined(__cpp_lib_source_location)
60 [[nodiscard]]
static constexpr auto
62#
if (__has_builtin(__builtin_FILE) and __has_builtin(__builtin_LINE))
63 const char* file = __builtin_FILE (),
int line = __builtin_LINE ()
65 const char* file =
"unknown",
int line = {}
75 [[nodiscard]]
constexpr auto
81 [[nodiscard]]
constexpr auto
103 [[nodiscard]]
constexpr auto
106#if defined(__clang__)
107#pragma GCC diagnostic push
108#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
111 return { &__PRETTY_FUNCTION__[78],
sizeof (__PRETTY_FUNCTION__) - 80 };
112#pragma GCC diagnostic pop
113#elif defined(__GNUC__)
116 return { &__PRETTY_FUNCTION__[93],
sizeof (__PRETTY_FUNCTION__) - 144 };
118#error "Unsupported compiler"
119 return "Unsupported compiler";
128#pragma GCC diagnostic pop
Local implementation of the std::source_location.
constexpr auto file_name() const noexcept
constexpr auto line() const noexcept
static constexpr auto current(const char *file="unknown", int line={}) noexcept
constexpr auto type_name() -> std::string_view
Parse the PRETTY_FUNCTION macro to extract the type name.
const char * short_name(const char *name)