Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for some pedantic warnings #1054

Merged
merged 5 commits into from
Feb 23, 2019
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
4 changes: 4 additions & 0 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
#if FMT_GCC_VERSION >= 406 || FMT_CLANG_VERSION
# pragma GCC diagnostic push

// Disable warning about not handling all enums in switch statement even with
// a default case
# pragma GCC diagnostic ignored "-Wswitch-enum"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you post specific warnings this is causing? Might be better to fix those instead of suppressing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screenshot_2019-02-23_13-29-00

I thought having a default case is cleaner and just disabling this warning is preferable.


// Disable the warning about declaration shadowing because it affects too
// many valid cases.
# pragma GCC diagnostic ignored "-Wshadow"
Expand Down
4 changes: 2 additions & 2 deletions include/format
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace std {
// Implementation details:
using format_arg = basic_format_arg<basic_format_context>;
basic_format_context(O out, basic_format_args<basic_format_context> args, fmt::internal::locale_ref)
: out_(out), args_(args) {}
: args_(args), out_(out) {}
fmt::internal::error_handler error_handler() const { return {}; }
basic_format_arg<basic_format_context> arg(fmt::basic_string_view<charT>) const {
return {}; // unused: named arguments are not supported yet
Expand Down Expand Up @@ -570,7 +570,7 @@ struct format_handler : fmt::internal::error_handler {
parse_ctx.check_arg_id(id);
arg = context.arg(id);
}
void on_arg_id(fmt::basic_string_view<Char> id) {}
void on_arg_id(fmt::basic_string_view<Char>) {}

void on_replacement_field(const Char* p) {
parse_ctx.advance_to(p);
Expand Down