From fef51dedd84fe7d494233a015a35f9f3d4e0fbef Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 24 Jun 2023 21:37:53 +0100 Subject: [PATCH] mail_daemon: warn about unused return value GCC 13 warns that using the `begin()` method on a container is marked as `[[nodiscard]]`. This makes sure that this warning is not treated as an error. The code actually looks like it does not do much if anything of use. As a follow-up ticket #18478 is raised. Change-Id: Ie149f7e02cacda2bcd0be59617583605d5905747 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6655 Reviewed-by: Niels Sascha Reedijk Tested-by: Commit checker robot --- .../inbound_protocols/imap/IMAPFolder.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp index ea3ab9b8c8..12a45027a1 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp @@ -408,10 +408,20 @@ IMAPFolder::RegisterPendingBodies(IMAP::MessageUIDList& uids, IMAP::MessageUIDList::const_iterator iterator = uids.begin(); for (; iterator != uids.end(); iterator++) { - if (replyTo != NULL) + if (replyTo != NULL) { fPendingBodies[*iterator].push_back(*replyTo); - else + } else { + // Note: GCC 13 warns about the unused result of the statement below. This code should + // be reviewed as part of #18478 + #if __GNUC__ == 13 + # pragma GCC diagnostic push + # pragma GCC diagnostic warning "-Wunused-result" + #endif fPendingBodies[*iterator].begin(); + #if __GNUC__ == 13 + # pragma GCC diagnostic pop + #endif + } } }