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