Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions cmake/HPX_AddConfigTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,6 @@ function(hpx_check_for_cxx20_lambda_capture)
)
endfunction()

# ##############################################################################
function(hpx_check_for_cxx20_source_location)
add_hpx_config_test(
HPX_WITH_CXX20_SOURCE_LOCATION
SOURCE cmake/tests/cxx20_source_location.cpp
FILE ${ARGN}
)
endfunction()

# ##############################################################################
function(hpx_check_for_pthread_setname_np)
add_hpx_config_test(
Expand Down
4 changes: 0 additions & 4 deletions cmake/HPX_PerformCxxFeatureTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ function(hpx_perform_cxx_feature_tests)
DEFINITIONS HPX_HAVE_CXX20_LAMBDA_CAPTURE
)

hpx_check_for_cxx20_source_location(
DEFINITIONS HPX_HAVE_CXX20_SOURCE_LOCATION
)

if(HPX_WITH_SUPPORT_NO_UNIQUE_ADDRESS_ATTRIBUTE AND NOT MSVC) # see above
hpx_check_for_cxx20_no_unique_address_attribute(
DEFINITIONS HPX_HAVE_CXX20_NO_UNIQUE_ADDRESS_ATTRIBUTE
Expand Down
4 changes: 1 addition & 3 deletions cmake/templates/std_headers.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
#endif

#include <bit>
#if defined(HPX_HAVE_CXX20_SOURCE_LOCATION)
# include <source_location>
#endif
#include <source_location>

#if defined(HPX_HAVE_CXX23_STD_GENERATOR)
# include <generator>
Expand Down
19 changes: 0 additions & 19 deletions cmake/tests/cxx20_source_location.cpp

This file was deleted.

8 changes: 0 additions & 8 deletions libs/core/assertion/include/hpx/assertion/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,5 @@
"on the issue tracker: https://github.com/STEllAR-GROUP/hpx/issues."); \
std::terminate()

#if defined(HPX_HAVE_CXX20_SOURCE_LOCATION)
#define HPX_CURRENT_SOURCE_LOCATION() std::source_location::current()
#else
#define HPX_CURRENT_SOURCE_LOCATION() \
::hpx::source_location \
{ \
__FILE__, static_cast<std::uint_least32_t>(__LINE__), __func__ \
}
#endif
#endif
56 changes: 0 additions & 56 deletions libs/core/assertion/include/hpx/assertion/source_location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,70 +13,14 @@

#include <hpx/config/export_definitions.hpp>

#include <cstdint>
#include <iosfwd>

#if defined(HPX_HAVE_CXX20_SOURCE_LOCATION)
#include <source_location>
#endif

namespace hpx {

/// This contains the location information where \a HPX_ASSERT has been
/// called
#if defined(HPX_HAVE_CXX20_SOURCE_LOCATION)
HPX_CXX_CORE_EXPORT using std::source_location;
#else
/// The \a source_location class represents certain information about the
/// source code, such as file names, line numbers, and function names.
/// Previously, functions that desire to obtain this information about
/// the call site (for logging, testing, or debugging purposes) must
/// use macros so that predefined macros like \a __LINE__ and \a __FILE__
/// are expanded in the context of the caller. The \a source_location class
/// provides a better alternative.
/// \a source_location meets the \a DefaultConstructible, \a CopyConstructible,
/// \a CopyAssignable and \a Destructible requirements. Lvalue of \a
/// source_location meets the Swappable requirement. Additionally, the following
/// conditions are true:
/// - \code std::is_nothrow_move_constructible_v<std::source_location> \endcode
/// - \code std::is_nothrow_move_assignable_v<std::source_location> \endcode
/// - \code std::is_nothrow_swappable_v<std::source_location> \endcode
/// It is intended that source_location has a small size and can be copied
/// efficiently.
/// It is unspecified whether the copy/move constructors and the copy/move
/// assignment operators of \a source_location are trivial and/or constexpr.
HPX_CXX_CORE_EXPORT struct source_location
{
char const* filename;
std::uint_least32_t line_number;
char const* functionname;

// compatibility with C++20 std::source_location
/// return the line number represented by this object
[[nodiscard]] constexpr std::uint_least32_t line() const noexcept
{
return line_number;
}

/// return the column number represented by this object
[[nodiscard]] static constexpr std::uint_least32_t column() noexcept
{
return 0;
}

/// return the file name represented by this object
[[nodiscard]] constexpr char const* file_name() const noexcept
{
return filename;
}

/// return the name of the function represented by this object, if any
[[nodiscard]] constexpr char const* function_name() const noexcept
{
return functionname;
}
};
#endif

HPX_CXX_CORE_EXPORT HPX_CORE_EXPORT std::ostream& operator<<(
std::ostream& os, source_location const& loc);
Expand Down
Loading