Skip to content

Commit

Permalink
source_location: Try use __has_include
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion committed Jan 21, 2025
1 parent 1f6f4db commit cd3aa7c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions kernel/register.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,25 @@
#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; }
const char* file_name() const { return "unknown"; }
const char* function_name() const { return "unknown"; }
static const source_location current(...) { return source_location(); }
};
# endif
#endif

YOSYS_NAMESPACE_BEGIN
Expand Down

0 comments on commit cd3aa7c

Please sign in to comment.