From: David Bremner Date: Fri, 21 Sep 2012 20:31:03 +0000 (+2100) Subject: Re: [PATCH 1/2] Annotate internal_error with the attribute noreturn X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=578387bc65ac312b45162d6823b2d9ec879f9348;p=notmuch-archives.git Re: [PATCH 1/2] Annotate internal_error with the attribute noreturn --- diff --git a/96/197e06ffcd7e1b9ccc7eb69206d0cbfdfaa98f b/96/197e06ffcd7e1b9ccc7eb69206d0cbfdfaa98f new file mode 100644 index 000000000..da1c4103f --- /dev/null +++ b/96/197e06ffcd7e1b9ccc7eb69206d0cbfdfaa98f @@ -0,0 +1,75 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 3BEA4431FAF + for ; Fri, 21 Sep 2012 13:31:40 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id CJsAeyzVXRex for ; + Fri, 21 Sep 2012 13:31:39 -0700 (PDT) +Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id BE20F431FAE + for ; Fri, 21 Sep 2012 13:31:39 -0700 (PDT) +Received: from convex-new.cs.unb.ca ([131.202.245.35]) + by tesseract.cs.unb.ca with esmtpsa + (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) + (envelope-from ) + id 1TF9sn-0001Mq-RQ; Fri, 21 Sep 2012 17:31:34 -0300 +Received: from bremner by convex-new.cs.unb.ca with local (Exim 4.80) + (envelope-from ) + id 1TF9sN-0001cA-ER; Fri, 21 Sep 2012 17:31:03 -0300 +From: David Bremner +To: Justus Winter <4winter@informatik.uni-hamburg.de>, notmuch@notmuchmail.org +Subject: Re: [PATCH 1/2] Annotate internal_error with the attribute noreturn +In-Reply-To: + <1348231837-21700-1-git-send-email-4winter@informatik.uni-hamburg.de> +References: + <1348231837-21700-1-git-send-email-4winter@informatik.uni-hamburg.de> +User-Agent: Notmuch/0.14+20~g69843dd (http://notmuchmail.org) Emacs/24.2.1 + (x86_64-pc-linux-gnu) +Date: Fri, 21 Sep 2012 17:31:03 -0300 +Message-ID: <87fw6bdsoo.fsf@convex-new.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain +X-Spam_bar: - +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 21 Sep 2012 20:31:40 -0000 + +Justus Winter <4winter@informatik.uni-hamburg.de> writes: + +> Annotating functions that do not return with the noreturn attribute +> (which is understood by both gcc and clang) prevents static analyzers +> from generating false positives (internal_error is used to terminate +> the process and is used extensively in error handling code paths). +> +> Remove the return statement that was placed there to appease the +> compiler. Functions annotated with noreturn are not supposed to return +> any values. +> + +This patch looks OK (although I don't know the pragma details). Do you +(or anyone) happen to know why _internal_error is an int function? +Making it void wouldn't fix the problem with static analzers, but having +an int function without a return looks ugly to me. + +d