From cade7493fde57fc1062d14b91d8a98ee487abd4c Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 18 Jun 2022 14:35:01 +0300 Subject: [PATCH] build: fix some compiler warnings --- lib/message/mu-contact.hh | 6 ++++++ lib/message/mu-message.cc | 5 +++++ lib/message/mu-mime-object.cc | 1 + lib/mu-maildir.hh | 12 ------------ lib/mu-parser.cc | 3 +++ lib/utils/mu-sexp.hh | 3 +++ lib/utils/mu-utils.cc | 2 -- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/message/mu-contact.hh b/lib/message/mu-contact.hh index 2c22bf92..06d9d16b 100644 --- a/lib/message/mu-contact.hh +++ b/lib/message/mu-contact.hh @@ -129,6 +129,8 @@ struct Contact { * @return the field-id or Nothing. */ constexpr Option field_id() const noexcept { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-enum" switch(type) { case Type::Bcc: return Field::Id::Bcc; @@ -141,6 +143,7 @@ struct Contact { default: return Nothing; } +#pragma GCC diagnostic pop } @@ -167,6 +170,8 @@ private: constexpr Option contact_type_from_field_id(Field::Id id) noexcept { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-enum" switch(id) { case Field::Id::Bcc: return Contact::Type::Bcc; @@ -179,6 +184,7 @@ contact_type_from_field_id(Field::Id id) noexcept { default: return Nothing; } +#pragma GCC diagnostic pop } using Contacts = std::vector; diff --git a/lib/message/mu-message.cc b/lib/message/mu-message.cc index 757d14c4..ea3507c2 100644 --- a/lib/message/mu-message.cc +++ b/lib/message/mu-message.cc @@ -490,6 +490,9 @@ handle_object(const MimeObject& parent, info.flags |= Flags::Encrypted; } else if (obj.is_mime_application_pkcs7_mime()) { MimeApplicationPkcs7Mime smime(obj); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-enum" + // CompressedData, CertsOnly, Unknown switch (smime.smime_type()) { case Mu::MimeApplicationPkcs7Mime::SecureMimeType::SignedData: info.flags |= Flags::Signed; @@ -500,6 +503,7 @@ handle_object(const MimeObject& parent, default: break; } +#pragma GCC diagnostic pop } } @@ -718,6 +722,7 @@ fill_document(Message::Private& priv) break; /* LCOV_EXCL_START */ case Field::Id::_count_: + default: break; /* LCOV_EXCL_STOP */ } diff --git a/lib/message/mu-mime-object.cc b/lib/message/mu-mime-object.cc index a8960b7e..1b0783b4 100644 --- a/lib/message/mu-mime-object.cc +++ b/lib/message/mu-mime-object.cc @@ -331,6 +331,7 @@ address_type(Contact::Type ctype) return GMIME_ADDRESS_TYPE_REPLY_TO; case Contact::Type::Sender: return GMIME_ADDRESS_TYPE_SENDER; + case Contact::Type::None: default: return Nothing; } diff --git a/lib/mu-maildir.hh b/lib/mu-maildir.hh index d2c4d568..f4f38d36 100644 --- a/lib/mu-maildir.hh +++ b/lib/mu-maildir.hh @@ -71,18 +71,6 @@ Result maildir_link(const std::string& src, const std::string& targetpath) */ Result maildir_clear_links(const std::string& dir); -/** - * get the maildir for a certain message path, ie, the path *before* - * cur/ or new/ and *after* the root. - * - * @param path path for some message - * @param root filesystem root for the maildir - * - * @return the maildir or an Error - */ -Result maildir_from_path(const std::string& path, - const std::string& root); - /** * Move a message file to another maildir. If the target file already exists, it * is overwritten. diff --git a/lib/mu-parser.cc b/lib/mu-parser.cc index a90051cb..3cde7c5f 100644 --- a/lib/mu-parser.cc +++ b/lib/mu-parser.cc @@ -96,6 +96,8 @@ process_value(const std::string& field, const std::string& value) { const auto id_opt{field_from_name(field)}; if (id_opt) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-enum" switch (id_opt->id) { case Field::Id::Priority: { if (!value.empty()) @@ -108,6 +110,7 @@ process_value(const std::string& field, const std::string& value) default: break; } +#pragma GCC diagnostic pop } return value; // XXX prio/flags, etc. alias diff --git a/lib/utils/mu-sexp.hh b/lib/utils/mu-sexp.hh index 725a37b1..f04b735b 100644 --- a/lib/utils/mu-sexp.hh +++ b/lib/utils/mu-sexp.hh @@ -415,6 +415,9 @@ operator<<(std::ostream& os, Sexp::Type id) case Sexp::Type::Symbol: os << "symbol"; break; + case Sexp::Type::Raw: + os << "raw"; + break; case Sexp::Type::Empty: os << "empty"; break; diff --git a/lib/utils/mu-utils.cc b/lib/utils/mu-utils.cc index bf24bd4a..0f9e6e36 100644 --- a/lib/utils/mu-utils.cc +++ b/lib/utils/mu-utils.cc @@ -50,8 +50,6 @@ #include "mu-error.hh" #include "mu-option.hh" -#include "message/mu-message-file.hh" - using namespace Mu; namespace {