3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-16 13:58:47 +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
#include <source_location>
using std::source_location;
#else
#include <experimental/source_location>
# ifdef __cpp_lib_experimental_source_location
#elif defined(__has_include)
# if __has_include(<experimental/source_location>)
#include <experimental/source_location>
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