Skip to content

Commit

Permalink
Small update
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryAWE committed Mar 22, 2024
1 parent e89e637 commit 04a34d7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 33 deletions.
1 change: 1 addition & 0 deletions include/papilio/detail/prefix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
# pragma clang diagnostic ignored "-Wc++20-compat"

# pragma clang diagnostic ignored "-Wpadded"
# pragma clang diagnostic ignored "-Wcovered-switch-default"
#endif
20 changes: 5 additions & 15 deletions include/papilio/format/fundamental.inl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
#include <cmath>
#include "helper.hpp"

#ifdef PAPILIO_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wcovered-switch-default"
#endif

namespace papilio
{
namespace detail
Expand Down Expand Up @@ -44,7 +39,7 @@ namespace detail
using context_t = format_context_traits<FormatContext>;

PAPILIO_ASSERT(m_data.fill != U'\0');
context_t::append(ctx, utf::codepoint(m_data.fill), count);
context_t::append(ctx, m_data.fill, count);
}
};

Expand Down Expand Up @@ -469,6 +464,7 @@ namespace detail
class string_formatter : public std_formatter_base
{
public:
using string_ref_type = utf::basic_string_ref<CharT>;
using string_container_type = utf::basic_string_container<CharT>;

void set_data(const std_formatter_data& data)
Expand All @@ -483,15 +479,13 @@ namespace detail
}

template <typename FormatContext>
auto format(string_container_type str, FormatContext& ctx)
auto format(string_ref_type str, FormatContext& ctx)
{
PAPILIO_ASSERT(!str.has_ownership());

using context_t = format_context_traits<FormatContext>;

std::size_t used = 0;

std::size_t used = 0; // Used width

// The "precision" for a string means the max width can be used.
if(m_data.precision != 0)
{
for(auto it = str.begin(); it != str.end(); ++it)
Expand Down Expand Up @@ -857,7 +851,3 @@ requires std::is_enum_v<T>
class formatter<T, CharT> : public detail::enum_formatter<T, CharT>
{};
} // namespace papilio

#ifdef PAPILIO_COMPILER_CLANG
# pragma clang diagnostic pop
#endif
9 changes: 0 additions & 9 deletions include/papilio/script/interpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,6 @@ class basic_interpreter_base : public script_base

static bool execute_op(op_id op, const variable_type& lhs, const variable_type& rhs)
{
#ifdef PAPILIO_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wcovered-switch-default"
#endif

switch(op)
{
case op_id::equal:
Expand All @@ -695,10 +690,6 @@ class basic_interpreter_base : public script_base
default:
PAPILIO_UNREACHABLE();
}

#ifdef PAPILIO_COMPILER_CLANG
# pragma clang diagnostic pop
#endif
}

// Parses integer value
Expand Down
7 changes: 7 additions & 0 deletions include/papilio/utf/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ class basic_string_ref<CharT> : public detail::str_impl<CharT, basic_string_ref<
return *this;
}

constexpr basic_string_ref& assign(const_iterator start, const_iterator stop) noexcept
{
this->set_view(start, stop);
return *this;
}

using my_base::find;

[[nodiscard]]
Expand Down Expand Up @@ -661,6 +667,7 @@ class basic_string_ref<CharT> : public detail::str_impl<CharT, basic_string_ref<

constexpr void set_view(const_iterator start, const_iterator stop) noexcept
{
PAPILIO_ASSERT(start <= stop);
set_view(string_view_type(start.base(), stop.base()));
}

Expand Down
9 changes: 0 additions & 9 deletions src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ static const char* to_cstr(script_error_code ec) noexcept
#define PAPILIO_SCRIPT_ERR(code, msg) \
case code: return msg

#ifdef PAPILIO_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wcovered-switch-default"
#endif

switch(ec)
{
PAPILIO_SCRIPT_ERR(no_error, "no error");
Expand All @@ -30,10 +25,6 @@ static const char* to_cstr(script_error_code ec) noexcept
[[unlikely]] default:
PAPILIO_SCRIPT_ERR(unknown_error, "unknown error");
}

#ifdef PAPILIO_COMPILER_CLANG
# pragma clang diagnostic pop
#endif
}

std::string to_string(script_error_code ec)
Expand Down

0 comments on commit 04a34d7

Please sign in to comment.