Skip to content

Commit

Permalink
fix: source location as argument of check function
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Jul 29, 2024
1 parent e205792 commit d8ee84a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions common/src/KokkosFFT_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

#ifndef KOKKOS_ENABLE_CXX17
#include <source_location>
#define KOKKOSFFT_EXPECTS(expression, msg) \
KokkosFFT::Impl::check_precondition(expression, msg)
#define KOKKOSFFT_EXPECTS(expression, msg) \
KokkosFFT::Impl::check_precondition(expression, msg, \
std::source_location::current())
#else
#include <cstdlib>
#define KOKKOSFFT_EXPECTS(expression, msg) \
Expand All @@ -28,9 +29,9 @@ namespace KokkosFFT {
namespace Impl {

#ifndef KOKKOS_ENABLE_CXX17
inline void check_precondition(const bool expression, const std::string& msg) {
inline void check_precondition(const bool expression, const std::string& msg,
std::source_location location) {
std::stringstream ss("file: ");
std::source_location location = std::source_location::current();
ss << location.file_name() << '(' << location.line() << ':'
<< location.column() << ") `" << location.function_name() << "`: " << msg
<< '\n';
Expand Down

0 comments on commit d8ee84a

Please sign in to comment.