Re: Static Analysis of PHP_5_4 with CLANG

From: Date: Mon, 06 Feb 2012 01:50:59 +0000
Subject: Re: Static Analysis of PHP_5_4 with CLANG
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-57756@lists.php.net to get a copy of this message
On Sun, Feb 5, 2012 at 17:08, Stas Malyshev <smalyshev@sugarcrm.com> wrote: > Hi! > > Another thing - is there any way to give CLANG some hints about some > functions - such as the fact that zend_error(E_ERROR) does not return or > just make some exceptions when we know some situation that it thinks can > happen does not in fact happen - such as revtal_ptr_ptr = &retval_ptr and > then passing retval_ptr_ptr would actually change retval_ptr somewhere on > the way, etc. > The idea is if we could weed out false positives and somehow mark them we > could use this tool in CI for detecting real errors. Clang (and its static analyzer) has a huge number of annotative attributes for everything which can be easily ifdef'd to nothing on non-Clang. <http://clang.llvm.org/docs/LanguageExtensions.html> gives most of them, and Clang also has the (nearly) full range of GCC's attributes. You can also disable the analyzer for non-annotatable false positives with a #if block (I forget the name of the macro off the top of my head). The most recent versions of clang should be able to trace aliased pointer paths to some extent, so if you're getting false positives there, it's possible there's a subtle issue (I haven't looked at the actual output). -- Gwynne

« previous php.internals (#57756) next »