From 23a066f71f2c508c043e2fd2457c5e82326e3a38 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 21 Jul 2025 10:34:54 +1200 Subject: [PATCH] source_location: Try use __has_include --- kernel/register.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/register.h b/kernel/register.h index 07d6f09c1..5cdb62ebe 100644 --- a/kernel/register.h +++ b/kernel/register.h @@ -27,11 +27,18 @@ #if __cpp_lib_source_location == 201907L #include using std::source_location; -#else - #include -# ifdef __cpp_lib_experimental_source_location +#elif defined(__has_include) +# if __has_include() + #include using std::experimental::source_location; # else + #define SOURCE_FALLBACK +# endif +#else + #define SOURCE_FALLBACK +#endif + +#ifdef SOURCE_FALLBACK struct source_location { // dummy placeholder int line() const { return 0; } int column() const { return 0; } @@ -39,7 +46,6 @@ struct source_location { // dummy placeholder const char* function_name() const { return "unknown"; } static const source_location current(...) { return source_location(); } }; -# endif #endif YOSYS_NAMESPACE_BEGIN