Skip to content

Commit

Permalink
[bot] run clang-format & amalgamation
Browse files Browse the repository at this point in the history
  • Loading branch information
fktn-k authored and github-actions[bot] committed Nov 11, 2024
1 parent f2f8448 commit 419254a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions single_include/fkYAML/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
#endif
#endif

#if defined(__clang__)
#define FK_YAML_NO_SANITIZE(...) __attribute__((no_sanitize(__VA_ARGS__)))
#else
#define FK_YAML_NO_SANITIZE(...)
#define FK_YAML_NO_SANITIZE_BEGIN(...)
#define FK_YAML_NO_SANITIZE_END
#endif

// switch usage of inline variables which have been available since C++17.
#if defined(FK_YAML_HAS_CXX_17)
#define FK_YAML_INLINE_VAR inline
Expand Down Expand Up @@ -401,11 +409,15 @@ struct generator<T, 1> {
template <typename T, T Num>
using make_integer_sequence
#if FK_YAML_HAS_BUILTIN(__make_integer_seq)
// clang defines built-in __make_integer_seq to generate an integer sequence.
= __make_integer_seq<integer_sequence, T, Num>;
#elif FK_YAML_HAS_BUILTIN(__integer_pack)
// GCC or other compilers may implement built-in __integer_pack to generate an
// integer sequence.
= integer_sequence<T, __integer_pack(Num)...>;
#else
= make_int_seq_impl::generator<T, Num>::type;
// fallback to the library implementation of make_integer_sequence.
= typename make_int_seq_impl::generator<T, Num>::type;
#endif

template <std::size_t... Idx>
Expand Down Expand Up @@ -13076,7 +13088,8 @@ class basic_node {

template <
typename ValueType, detail::enable_if_t<detail::negation<detail::is_basic_node<ValueType>>::value, int> = 0>
void get_value_impl(ValueType& v) const noexcept(noexcept(ConverterType<ValueType, void>::from_node(*this, v))) {
void get_value_impl(ValueType& v) const
noexcept(noexcept(ConverterType<ValueType, void>::from_node(std::declval<const basic_node&>(), v))) {
ConverterType<ValueType, void>::from_node(*this, v);
}

Expand Down Expand Up @@ -13337,6 +13350,7 @@ template <
template <typename, typename...> class SequenceType, template <typename, typename, typename...> class MappingType,
typename BooleanType, typename IntegerType, typename FloatNumberType, typename StringType,
template <typename, typename = void> class ConverterType>
// NOLINTNEXTLINE(cert-dcl58)
struct hash<fkyaml::basic_node<
SequenceType, MappingType, BooleanType, IntegerType, FloatNumberType, StringType, ConverterType>> {
using node_t = fkyaml::basic_node<
Expand Down Expand Up @@ -13391,8 +13405,9 @@ struct hash<fkyaml::basic_node<

private:
// taken from boost::hash_combine
FK_YAML_NO_SANITIZE("unsigned-shift-base", "unsigned-integer-overflow")
static void hash_combine(std::size_t& seed, std::size_t v) {
seed ^= v + 0x9e3779b9 + (seed << 6) + (seed >> 2);
seed ^= v + 0x9e3779b9 + (seed << 6u) + (seed >> 2u);
}
};

Expand Down

0 comments on commit 419254a

Please sign in to comment.