3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-25 21:57:01 +00:00

source_location: Try use __has_include

This commit is contained in:
Krystine Sherwin 2025-03-21 10:26:11 +13:00
parent d244b4a101
commit 34c514bf96
No known key found for this signature in database

View file

@ -27,11 +27,18 @@
#if __cpp_lib_source_location == 201907L #if __cpp_lib_source_location == 201907L
#include <source_location> #include <source_location>
using std::source_location; using std::source_location;
#else #elif defined(__has_include)
#include <experimental/source_location> # if __has_include(<experimental/source_location>)
# ifdef __cpp_lib_experimental_source_location #include <experimental/source_location>
using std::experimental::source_location; using std::experimental::source_location;
# else # else
#define SOURCE_FALLBACK
# endif
#else
#define SOURCE_FALLBACK
#endif
#ifdef SOURCE_FALLBACK
struct source_location { // dummy placeholder struct source_location { // dummy placeholder
int line() const { return 0; } int line() const { return 0; }
int column() const { return 0; } int column() const { return 0; }
@ -39,7 +46,6 @@ struct source_location { // dummy placeholder
const char* function_name() const { return "unknown"; } const char* function_name() const { return "unknown"; }
static const source_location current(...) { return source_location(); } static const source_location current(...) { return source_location(); }
}; };
# endif
#endif #endif
YOSYS_NAMESPACE_BEGIN YOSYS_NAMESPACE_BEGIN