From patchwork Thu Oct 23 21:08:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 402681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4443D14008C for ; Fri, 24 Oct 2014 08:08:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=ByMyjCAUpDgQksRmX lYr9TzaXmKP5J72YUPTEuDwMmkx2zWtJA9oPWUcJI3KarE0wGhmQ9TmvbZV22aq4 u9OdxnR3CgzlYFuQZDp4cnHPq+qv1VbzQG8AeP2TH41KdCTBrORUazKlm2+wA+vA njSTNFehK7ZsV8ecf1EU0W9uXI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=WfIqccDxhaMOw4BVdWXaTuf TSDI=; b=wOoSk9Uj2EwCm1RhBopT37TvgwdqkQkRuWut530sWmHI4LTW1AH5f9r dhkcAit+3eLps7GHZ1IAHw7CnOoZXGVox1UtzjjHxL4nUeCrL+96Rm7GLdnK/FvY knxXLMSdPchza3UOnWLhvUvHjuOwEVP/M++EwykrWa7j5hH8nq+Y= Received: (qmail 18751 invoked by alias); 23 Oct 2014 21:08:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 18672 invoked by uid 89); 23 Oct 2014 21:08:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 23 Oct 2014 21:08:29 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9NL8SbR022039 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 Oct 2014 17:08:28 -0400 Received: from localhost (ovpn-116-123.ams2.redhat.com [10.36.116.123]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9NL8RYs028840; Thu, 23 Oct 2014 17:08:27 -0400 Date: Thu, 23 Oct 2014 22:08:26 +0100 From: Jonathan Wakely To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, jason@gcc.gnu.org Subject: Re: [patch] c++/63619 Use -Wdelete-incomplete for "deleting 'void' is undefined" warning Message-ID: <20141023210826.GC3033@redhat.com> References: <20141023195938.GB3033@redhat.com> <54495EB7.6010804@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <54495EB7.6010804@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) On 23/10/14 16:01 -0400, Jason Merrill wrote: >On 10/23/2014 03:59 PM, Jonathan Wakely wrote: >>Tested x86_64-linux. OK for trunk? > >Shouldn't there be another test that there's no warning if >-Wno-delete-incomplete or that it's an error with >-Werror=delete-incomplete? OK that way. Oh yes, of course - here's what I've committed then. commit 9066b282eed98c3ba62f04ff9338b3772c04224e Author: Jonathan Wakely Date: Thu Oct 23 18:11:22 2014 +0100 PR c++/63619 gcc/cp: PR c++/63619 * decl2.c (delete_sanity): Use OPT_Wdelete_incomplete in warning. gcc/testsuite: PR c++/63619 * g++.dg/warn/Wdelete-incomplete-3.C: New. * g++.dg/warn/Wdelete-incomplete-4.C: New. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4be4847..60c8a63 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -478,7 +478,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete, /* Deleting ptr to void is undefined behavior [expr.delete/3]. */ if (VOID_TYPE_P (TREE_TYPE (type))) { - warning (0, "deleting %qT is undefined", type); + warning (OPT_Wdelete_incomplete, "deleting %qT is undefined", type); doing_vec = 0; } diff --git a/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C new file mode 100644 index 0000000..2202d60 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C @@ -0,0 +1,6 @@ +// PR c++/63619 + +int main() { + void* p; + delete p; // { dg-warning "undefined" } +} diff --git a/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C new file mode 100644 index 0000000..f2eb5ba --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C @@ -0,0 +1,7 @@ +// PR c++/63619 +// { dg-options -Wno-delete-incomplete } + +int main() { + void* p; + delete p; +}