From patchwork Thu Apr 20 15:09:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 752836 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 3w82My1Vbpz9s2Q for ; Fri, 21 Apr 2017 01:09:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GpE+lxgs"; dkim-atps=neutral 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:mime-version:content-type; q=dns; s=default; b=cOLvObPu7eJ0br4G85Ew+rnjUA/KmmCaThw6WnRs6boUIzoA/s iD7YB7NE06dWAlMEdzOZpZHy1YM9UxWutKervZUqcOJYgJNIt5ZM3AnSbc7sDRA9 OF1egBNEdxEwC5MRqfe0lShsKhhiQayp1RBsXLQfCTpc5vkaWG8w0L+mk= 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:mime-version:content-type; s= default; bh=zVKskMxoZKZgdzEaj3TaHbTAQqY=; b=GpE+lxgsRcMh/EL+4Gvo FPtdsRVYTONO/e0an5CCM4h8HYiatrJ6qWR7t01Z7j7EYPWKQnLd0FGVFT/uT57N rmeiJVali24F4tUIxSyuZ4G2nbrdWMboQ9STTwVHq1zPR4IxYI7ztPwjJmt3ZbZ/ KqtwF1D5mUDLSuNINwXr0Fw= Received: (qmail 20412 invoked by alias); 20 Apr 2017 15:09:23 -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 20388 invoked by uid 89); 20 Apr 2017 15:09:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=suppressing, H*MI:20170420150920 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 ESMTP; Thu, 20 Apr 2017 15:09:21 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 988CBF5D0 for ; Thu, 20 Apr 2017 15:09:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 988CBF5D0 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jwakely@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 988CBF5D0 Received: from localhost (unknown [10.33.36.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2775381416; Thu, 20 Apr 2017 15:09:20 +0000 (UTC) Date: Thu, 20 Apr 2017 16:09:20 +0100 From: Jonathan Wakely To: gcc-patches@gcc.gnu.org Cc: Jason Merrill Subject: [PATCH] PR c++/80473 allow suppressing notes about over-aligned new Message-ID: <20170420150920.GO3412@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.0 (2017-02-23) This suppresses the notes about over-aligned new when the corresponding warning is suppressed, either by -w or because it's in a system header (as in PR 80390, which I originally tried to fix in the library). OK for trunk? And gcc-7-branch after 7.1 is released? Is this the right place for the new test? gcc/cp: PR c++/80473 * init.c (build_new_1): Suppress notes about over-aligned new when the warning is suppressed. gcc/testsuite: PR c++/80473 * init.c (build_new_1): Suppress notes in system headers. PR c++/80473 * g++.dg/diagnostic/pr80473.C: New test. commit 66697a6551dd13715c2156ac6b2d5969010c12db Author: Jonathan Wakely Date: Thu Apr 20 15:24:09 2017 +0100 PR c++/80473 allow suppressing notes about over-aligned new gcc/cp: PR c++/80473 * init.c (build_new_1): Suppress notes about over-aligned new when the warning is suppressed. gcc/testsuite: PR c++/80473 * g++.dg/diagnostic/pr80473.C: New test. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index bfa9020..2e72451 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3128,11 +3128,14 @@ build_new_1 (vec **placement, tree type, tree nelts, { warning (OPT_Waligned_new_, "% of type %qT with extended " "alignment %d", elt_type, TYPE_ALIGN_UNIT (elt_type)); - inform (input_location, "uses %qD, which does not have an alignment " - "parameter", alloc_fn); - if (!aligned_new_threshold) - inform (input_location, "use %<-faligned-new%> to enable C++17 " - "over-aligned new support"); + if (diagnostic_report_warnings_p (global_dc, input_location)) + { + inform (input_location, "uses %qD, which does not have an alignment " + "parameter", alloc_fn); + if (!aligned_new_threshold) + inform (input_location, "use %<-faligned-new%> to enable C++17 " + "over-aligned new support"); + } } /* If we found a simple case of PLACEMENT_EXPR above, then copy it diff --git a/gcc/testsuite/g++.dg/diagnostic/pr80473.C b/gcc/testsuite/g++.dg/diagnostic/pr80473.C new file mode 100644 index 0000000..6a739f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr80473.C @@ -0,0 +1,14 @@ +// { dg-do compile { target c++11 } } +// { dg-bogus "over-aligned new" "PR c++/80473" { target *-*-* } 0 } +template T&& declval(); + +template +struct is_constructible { enum { value = 0 }; }; + +template +struct is_constructible()), void())> +{ enum { value = 1 }; }; + +struct alignas(64) A { int i; }; + +constexpr bool b = is_constructible::value;