Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57756 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94824 invoked from network); 6 Feb 2012 01:51:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2012 01:51:08 -0000 Authentication-Results: pb1.pair.com header.from=gwynne@darkrainfall.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=gwynne@darkrainfall.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain darkrainfall.org from 209.85.216.170 cause and error) X-PHP-List-Original-Sender: gwynne@darkrainfall.org X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:53369] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/93-60839-A023F2F4 for ; Sun, 05 Feb 2012 20:51:07 -0500 Received: by qcmt36 with SMTP id t36so3080166qcm.29 for ; Sun, 05 Feb 2012 17:51:03 -0800 (PST) Received: by 10.229.75.215 with SMTP id z23mr5744388qcj.111.1328493062520; Sun, 05 Feb 2012 17:51:02 -0800 (PST) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx.google.com with ESMTPS id m20sm30485056qaj.14.2012.02.05.17.51.00 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Feb 2012 17:51:01 -0800 (PST) Received: by wibhm4 with SMTP id hm4so4798170wib.29 for ; Sun, 05 Feb 2012 17:50:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.181.13.113 with SMTP id ex17mr24503757wid.15.1328493059103; Sun, 05 Feb 2012 17:50:59 -0800 (PST) Received: by 10.223.1.198 with HTTP; Sun, 5 Feb 2012 17:50:59 -0800 (PST) In-Reply-To: <4F2EFDD1.4090103@sugarcrm.com> References: <4F2EDE20.50207@php.net> <4F2EFB75.6010204@sugarcrm.com> <4F2EFDD1.4090103@sugarcrm.com> Date: Sun, 5 Feb 2012 20:50:59 -0500 Message-ID: To: Stas Malyshev Cc: "internals@lists.php.net" , Sebastian Bergmann Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Static Analysis of PHP_5_4 with CLANG From: gwynne@darkrainfall.org (Gwynne Raskind) On Sun, Feb 5, 2012 at 17:08, Stas Malyshev 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. 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