unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Justus Winter <4winter@informatik.uni-hamburg.de>
To: notmuch@notmuchmail.org
Subject: [PATCH 4/6] Fix the COERCE_STATUS macro
Date: Mon, 24 Sep 2012 17:21:18 +0200	[thread overview]
Message-ID: <1348500080-29726-4-git-send-email-4winter@informatik.uni-hamburg.de> (raw)
In-Reply-To: <1348500080-29726-1-git-send-email-4winter@informatik.uni-hamburg.de>

Fix the COERCE_STATUS macro to handle _internal_error being declared
as void function.

Note that the function _internal_error does not return. Evaluating to
NOTMUCH_STATUS_SUCCESS is done purely to appease the compiler.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
---
 lib/notmuch-private.h |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index bfb4111..7a409f5 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -136,13 +136,17 @@ typedef enum _notmuch_private_status {
  * to or greater than NOTMUCH_STATUS_LAST_STATUS. (The idea here is
  * that the caller has previously handled any expected
  * notmuch_private_status_t values.)
+ *
+ * Note that the function _internal_error does not return. Evaluating
+ * to NOTMUCH_STATUS_SUCCESS is done purely to appease the compiler.
  */
 #define COERCE_STATUS(private_status, format, ...)			\
     ((private_status >= (notmuch_private_status_t) NOTMUCH_STATUS_LAST_STATUS)\
      ?									\
-     (notmuch_status_t) _internal_error (format " (%s).\n",		\
-                                         ##__VA_ARGS__,			\
-                                         __location__)			\
+     _internal_error (format " (%s).\n",				\
+                      ##__VA_ARGS__,					\
+                      __location__),					\
+     (notmuch_status_t) NOTMUCH_PRIVATE_STATUS_SUCCESS			\
      :									\
      (notmuch_status_t) private_status)
 
-- 
1.7.10.4

  parent reply	other threads:[~2012-09-24 15:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 12:50 [PATCH 1/2] Annotate internal_error with the attribute noreturn Justus Winter
2012-09-21 12:50 ` [PATCH 2/2] Avoid potentially dereferencing a NULL pointer Justus Winter
2012-09-22 16:19   ` Austin Clements
2012-09-24 12:55     ` Justus Winter
2012-09-21 20:31 ` [PATCH 1/2] Annotate internal_error with the attribute noreturn David Bremner
2012-09-22 16:12 ` Austin Clements
2012-09-22 20:03   ` Tomi Ollila
2012-09-24 10:31   ` RFC: Annotate internal_error with the attribute noreturn 2nd patchset Justus Winter
2012-09-24 10:31     ` [PATCH 1/5] RFC: Provide a __has_attribute compatibility macro Justus Winter
2012-09-24 10:31     ` [PATCH 2/5] RFC: Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE Justus Winter
2012-09-24 10:31     ` [PATCH 3/5] Fix the COERCE_STATUS macro Justus Winter
2012-09-24 10:31     ` [PATCH 4/5] Annotate internal_error with the attribute noreturn Justus Winter
2012-09-24 10:31     ` [PATCH 5/5] Avoid potentially dereferencing a NULL pointer Justus Winter
2012-09-24 10:44     ` RFC: Annotate internal_error with the attribute noreturn 2nd patchset David Bremner
2012-09-24 12:50       ` Justus Winter
2012-09-24 14:41         ` David Bremner
2012-09-24 15:21           ` [PATCH 1/6] Provide a __has_attribute compatibility macro Justus Winter
2012-09-24 15:21             ` [PATCH 2/6] Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE Justus Winter
2012-09-24 15:21             ` [PATCH 3/6] Extend compat/README Justus Winter
2012-09-24 15:21             ` Justus Winter [this message]
2012-09-24 17:44               ` [PATCH 4/6] Fix the COERCE_STATUS macro Austin Clements
2012-09-25  8:55                 ` Tomi Ollila
2012-09-24 15:21             ` [PATCH 5/6] Annotate internal_error with the attribute noreturn Justus Winter
2012-09-24 15:21             ` [PATCH 6/6] Avoid potentially dereferencing a NULL pointer Justus Winter
2012-09-27 15:57             ` [PATCH 1/6] Provide a __has_attribute compatibility macro David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348500080-29726-4-git-send-email-4winter@informatik.uni-hamburg.de \
    --to=4winter@informatik.uni-hamburg.de \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).