Skip to content

Commit

Permalink
fix some clang C++20 and fmt conversion issues
Browse files Browse the repository at this point in the history
Signed-off-by: Ralph J. Steinhagen <[email protected]>
  • Loading branch information
RalphSteinhagen committed Jun 22, 2023
1 parent 034d854 commit b600e77
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 93 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ include(FetchContent)
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 8.1.1
GIT_TAG 10.0.0
)

FetchContent_Declare(
Expand Down
16 changes: 11 additions & 5 deletions include/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,12 @@ node_description() noexcept {

// re-enable once string and constexpr static is supported by all compilers
/*constexpr*/ std::string ret = fmt::format("# {}\n{}\n{}\n**supported data types:**", //
fair::meta::type_name<DerivedNode>(), Description::value,
fair::meta::type_name<DerivedNode>(), Description::value._data,
is_blocking ? "**BlockingIO**\n_i.e. potentially non-deterministic/non-real-time behaviour_\n" : "");
fair::meta::typelist<SupportedTypes>::template apply_func([&](auto index, auto &&t) { ret += fmt::format("{}:{} ", index, fair::meta::type_name<decltype(t)>()); });
fair::meta::typelist<SupportedTypes>::template apply_func([&](std::size_t index, auto &&t) {
std::string type_name = fair::meta::type_name<decltype(t)>();
ret += fmt::format("{}:{} ", index, type_name);
});
ret += fmt::format("\n**Parameters:**\n");
if constexpr (refl::is_reflectable<DerivedNode>()) {
for_each(refl::reflect<DerivedNode>().members, [&](auto member) {
Expand All @@ -740,13 +743,16 @@ node_description() noexcept {

if constexpr (is_readable(member) && (std::integral<Type> || std::floating_point<Type> || std::is_same_v<Type, std::string>) ) {
if constexpr (is_annotated<RawType>()) {
const std::string type_name = refl::detail::get_type_name<Type>().str();
const std::string member_name = get_display_name_const(member).str();
ret += fmt::format("{}{:10} {:<20} - annotated info: {} unit: [{}] documentation: {}{}\n", RawType::visible() ? "" : "_", //
refl::detail::get_type_name<Type>(), get_display_name_const(member).str(), //
type_name, member_name, //
RawType::description(), RawType::unit(), RawType::documentation(), //
RawType::visible() ? "" : "_");
} else {
ret += fmt::format("_{:10} {}_\n", //
refl::detail::get_type_name<Type>(), get_display_name_const(member).str());
const std::string type_name = refl::detail::get_type_name<Type>().str();
const std::string member_name = get_display_name_const(member).str();
ret += fmt::format("_{:10} {}_\n", type_name, member_name);
}
}
});
Expand Down
21 changes: 19 additions & 2 deletions include/tag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,25 @@ using property_map = std::map<std::string, pmtv::pmt, detail::transparent_less>;
* so that there is only one tag per scheduler iteration. Multiple tags on the same sample shall be merged to one.
*/
struct alignas(hardware_constructive_interference_size) tag_t {
std::make_signed_t<std::size_t> index = 0;
property_map map;
using signed_index_type = std::make_signed_t<std::size_t>;
signed_index_type index{ 0 };
property_map map{};

tag_t() = default;

tag_t(signed_index_type index, property_map map_) noexcept : index(index), map(std::move(map_)) {}

tag_t(const tag_t &other) = default;

tag_t &
operator=(const tag_t &other)
= default;

tag_t(tag_t &&other) noexcept = default;

tag_t &
operator=(tag_t &&other) noexcept
= default;

bool
operator==(const tag_t &other) const
Expand Down
Loading

0 comments on commit b600e77

Please sign in to comment.