From owner-freebsd-current@FreeBSD.ORG Fri Jan 7 07:49:02 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72190106566B for ; Fri, 7 Jan 2011 07:49:02 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (lev.vlakno.cz [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 2BAE28FC08 for ; Fri, 7 Jan 2011 07:49:01 +0000 (UTC) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 139639CB0C4; Fri, 7 Jan 2011 08:49:00 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by lev.vlakno.cz (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FWceQzYJP3E3; Fri, 7 Jan 2011 08:48:59 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 32A659CB50A; Fri, 7 Jan 2011 08:48:59 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.4/8.14.4/Submit) id p077mwh9087429; Fri, 7 Jan 2011 08:48:58 +0100 (CET) (envelope-from rdivacky) Date: Fri, 7 Jan 2011 08:48:58 +0100 From: Roman Divacky To: Erik Cederstrand Message-ID: <20110107074858.GA87281@freebsd.org> References: <20110105131439.GN23329@acme.spoerlein.net> <20110105193653.GA49285@stack.nl> <7FA66A47-CB15-4C22-8614-B58E986CFFA4@cederstrand.dk> <201101062056.55807.tijl@coosemans.org> <1EF28C3A-954D-4A4B-8069-F0E767EF3669@cederstrand.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1EF28C3A-954D-4A4B-8069-F0E767EF3669@cederstrand.dk> User-Agent: Mutt/1.4.2.3i Cc: Tijl Coosemans , freebsd-current@freebsd.org Subject: Re: FYI: clang static analyzer page has moved to http://scan.freebsd.your.org/freebsd-head/ X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jan 2011 07:49:02 -0000 On Thu, Jan 06, 2011 at 11:59:07PM +0100, Erik Cederstrand wrote: > > Den 06/01/2011 kl. 20.56 skrev Tijl Coosemans: > > > On Thursday 06 January 2011 09:01:09 Erik Cederstrand wrote: > >> Den 05/01/2011 kl. 20.36 skrev Jilles Tjoelker: > >>> On Wed, Jan 05, 2011 at 05:55:45PM +0100, Ulrich Sp?rlein wrote: > >>>> - get IPA to work with clang, or at least file a bug > >>>> - mark functions as __dead2 (please don't do that) > >>> > >>> Why not? > >> > >> Because the analyzer is supposed to find bugs. Only the function that > >> really doesn't return should be marked as such. If we begin spewing > >> __dead2's everywhere, it's bound to silence a valid bug somewhere > >> down the line when e.g. a conditional in a print_help() function is > >> changed subtly so it doesn't always reach exit(). > > > > On the other hand you can't really expect the compiler/analyser to know > > what a procedure in another file does, so in that case you need __dead2 > > anyway. [...] > > I have high expectations of LLVM :-) LLVM already has some knowledge of what's going on in other files (see LTO) so why shouldn't it be able to detect the __noreturn__ ? All the necessary information should be readily available. the static analyzer has nothing to do with LLVM. it's a clang component and uses only the info that clang knows. and clang (ie. the C frontend) does not perform any analysis of this kind, thus it does not know that stuff is dead. fwiw - my trivial (but working) patch brought down the number of reports by mere 5% so the bulk is probably somewhere else...