From owner-svn-src-all@FreeBSD.ORG Thu Nov 29 16:24:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F7673C7; Thu, 29 Nov 2012 16:24:17 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) by mx1.freebsd.org (Postfix) with ESMTP id CC48A8FC14; Thu, 29 Nov 2012 16:24:16 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 8EF0A1203C0; Thu, 29 Nov 2012 17:24:12 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 68D522848C; Thu, 29 Nov 2012 17:24:12 +0100 (CET) Date: Thu, 29 Nov 2012 17:24:12 +0100 From: Jilles Tjoelker To: Konstantin Belousov Subject: Re: svn commit: r243665 - head/sbin/dump Message-ID: <20121129162412.GD29338@stack.nl> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121129120147.GE3013@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 16:24:17 -0000 On Thu, Nov 29, 2012 at 02:01:47PM +0200, Konstantin Belousov wrote: > On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: > > Author: eadler > > Date: Thu Nov 29 05:16:50 2012 > > New Revision: 243665 > > URL: http://svnweb.freebsd.org/changeset/base/243665 > > Log: > > Mark non-returning function as such > > PR: bin/172978 > > Approved by: cperciva > > MFC after: 3 days > > Modified: > > head/sbin/dump/dump.h > > Modified: head/sbin/dump/dump.h > > ============================================================================== > > --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) > > +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) > > @@ -121,7 +121,7 @@ void trewind(void); > > void writerec(char *dp, int isspcl); > > > > void Exit(int status) __dead2; > > -void dumpabort(int signo); > > +void dumpabort(int signo) __dead2; > > void dump_getfstab(void); > > > > char *rawname(char *cp); > What is the goal of this change ? This has been discussed before in http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022179.html and the rest of the thread. The result there seems that it is the least bad thing to add __dead2 even on static functions that do not return to reduce compiler/analyzer warnings and improve the generated code with GCC 4.2.1 and GCC 4.5. > It is arguably backward. There is absolutely no use to mark signal > handler as __dead2, and all other uses do not benefit from the > redundand declaration. Although most of the uses of dumpabort() are in the same file as its definition, GCC 4.2.1 is too dumb to detect its noreturn property automatically. Furthermore, some of the uses are in separate files. In particular, __dead2 on dumpabort() is required to mark or detect quit() as noreturn. > Also, being quite removed from the function definition, there is a > chance that some future modification would make the attribute a lie. Both GCC and Clang generate a warning by default if it appears possible for a noreturn function to return, so as long as -Werror remains enabled it should be safe enough. -- Jilles Tjoelker