Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Commit

Permalink
Fix some warnings from Clang -Wall (#14)
Browse files Browse the repository at this point in the history
* Fix some warnings from Clang -Wall

* Remove useless constexpr that triggers Clang warning in -Wall

* signed/unsigned comparison fix

* Another constexpr removal
  • Loading branch information
seanmiddleditch authored Apr 29, 2019
1 parent 9e7e7a0 commit 15b7b71
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/formatxx/_detail/format_arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class formatxx::_detail::basic_format_arg {
constexpr basic_format_arg(_detail::format_arg_type type, void const* value) noexcept : _type(type), _value(value) {}
constexpr basic_format_arg(thunk_type thunk, void const* value) noexcept : _type(_detail::format_arg_type::custom), _thunk(thunk), _value(value) {}

constexpr FORMATXX_PUBLIC result_code FORMATXX_API format_into(basic_format_writer<CharT>& output, basic_format_options<CharT> const& options) const;
FORMATXX_PUBLIC result_code FORMATXX_API format_into(basic_format_writer<CharT>& output, basic_format_options<CharT> const& options) const;

private:
_detail::format_arg_type _type = _detail::format_arg_type::unknown;
Expand Down
2 changes: 1 addition & 1 deletion include/formatxx/_detail/format_arg_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <cinttypes>

template <typename CharT>
constexpr formatxx::result_code FORMATXX_API formatxx::_detail::basic_format_arg<CharT>::format_into(basic_format_writer<CharT>& output, basic_format_options<CharT> const& options) const {
formatxx::result_code FORMATXX_API formatxx::_detail::basic_format_arg<CharT>::format_into(basic_format_writer<CharT>& output, basic_format_options<CharT> const& options) const {
switch (_type) {
case _detail::format_arg_type::char_t:
_detail::write_char(output, *static_cast<char const*>(_value), options);
Expand Down
1 change: 0 additions & 1 deletion include/formatxx/_detail/printf_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ namespace formatxx::_detail {

// parse forward through the specification and verify that it's correct and will
// properly decode in parse_format_spec later.
CharT const* const spec_begin = iter;
basic_parse_spec_result<CharT> const spec_result = parse_printf_spec(basic_string_view<CharT>(iter, end));
if (spec_result.code != result_code::success) {
result = spec_result.code;
Expand Down
2 changes: 1 addition & 1 deletion include/formatxx/_detail/write_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace formatxx::_detail {

int const result = float_helper(buf, buf_size, fmt_ptr, options.width, options.precision, value);
if (result > 0) {
out.write({ buf, result < buf_size ? std::size_t(result) : buf_size });
out.write({ buf, std::size_t(result) < buf_size ? std::size_t(result) : buf_size });
}
}

Expand Down
10 changes: 7 additions & 3 deletions include/formatxx/_detail/write_wide.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@

namespace formatxx::_detail {

#pragma warning(push)
#pragma warning(disable: 4996)
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4996)
#endif

inline void write_char(wformat_writer& out, char ch, wformat_options const&) noexcept {
std::mbstate_t state{};
Expand Down Expand Up @@ -83,6 +85,8 @@ namespace formatxx::_detail {

} // namespace formatx::_detail

#pragma warning(pop)
#if defined(_MSC_VER)
# pragma warning(pop)
#endif

#endif // !defined(_guard_FORMATXX_DETAIL_WRITE_WIDE_H)

0 comments on commit 15b7b71

Please sign in to comment.