From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8667 invoked by alias); 13 Aug 2011 11:09:55 -0000 Received: (qmail 8651 invoked by uid 22791); 13 Aug 2011 11:09:53 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from 20.mo4.mail-out.ovh.net (HELO mo4.mail-out.ovh.net) (46.105.33.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 13 Aug 2011 11:09:37 +0000 Received: from mail192.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo4.mail-out.ovh.net (Postfix) with SMTP id CC199FF8C39 for ; Sat, 13 Aug 2011 13:09:51 +0200 (CEST) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 13 Aug 2011 13:09:35 +0200 Received: from aannecy-651-1-65-169.w86-209.abo.wanadoo.fr (HELO ?192.168.1.6?) (piervit@pvittet.com@86.209.208.169) by ns0.ovh.net with SMTP; 13 Aug 2011 13:09:34 +0200 Message-ID: <4E465B6B.6070402@pvittet.com> Date: Sat, 13 Aug 2011 11:09:00 -0000 From: Pierre Vittet User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110705 Thunderbird/3.1.11 MIME-Version: 1.0 To: Jonathan Wakely CC: gcc@gcc.gnu.org, Basile Starynkevitch , Alexandre Lissy , patrick.martineau@univ-tours.fr X-Ovh-Mailout: 178.32.228.4 (mo4.mail-out.ovh.net) Subject: Re: [GSOC] Customizable warnings with a GCC plugin References: <4E453EC2.1030600@pvittet.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Ovh-Tracer-Id: 6588203306791534666 X-Ovh-Remote: 86.209.208.169 (aannecy-651-1-65-169.w86-209.abo.wanadoo.fr) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -200 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfedvjedruddvucetggdotefuucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmneculddquddttddm X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00265.txt.bz2 Hello, thanks for you mail. You are right my plugin returns a 'false' warning on your case. That should be possible to handle this case but it needs some search: when parsing func,we should request to look at the Guard constructor (either by inserting a new pass or maybe by using LTO (but I should look deeper at this)) to check if there is a test or no. For the moment my plugin's 'view' is limited to a single function but that should be something to improve. Pierre Vittet On 12/08/2011 18:00, Jonathan Wakely wrote: > On 12 August 2011 15:54, Pierre Vittet wrote: >> >> For the moment, the plugin has only be tested on C code, this might >> works with only few changes for C++. > > Would your example tests for grub warn about the following C++ code? > > struct Guard { > Guard(void* p) : p(p) { if (!p) throw std::bad_alloc(); } > ~Guard() { grub_free(p); } > void* p; > }; > > void func(grub_size_t n) > { > Guard g(grub_malloc(n)); > // do something with g.p > } > > For it to be useful for C++ it would be necessary to not warn about that code. >