From patchwork Mon Dec 12 16:36:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 87720 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1737053qgi; Mon, 12 Dec 2016 08:36:53 -0800 (PST) X-Received: by 10.99.0.194 with SMTP id 185mr168668832pga.111.1481560612935; Mon, 12 Dec 2016 08:36:52 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a2si43952535pgf.207.2016.12.12.08.36.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 08:36:52 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444184-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444184-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444184-patch=linaro.org@gcc.gnu.org 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:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=dKSuekTRjVjsmkutWvxtDdQZB52bvE rTVjTEiVt106pB5J2kgBCOpa72MGsTwciZ6OAuBl+wiGhEz6zM8NvvW5LKQPw6mp xoo2wc5RS59QtGaABC0EOjUuYeAFBT5j18pH0jLMt+T/U1+xXJx1u5F4AhgAr+d4 CZk4OEry5zVe8= 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:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=3CzUAEP2l5WTlTNK0dWJXn6Rg3o=; b=tLg/ vR8erBuM/6bNmlj+BGuHxhr5TdeM/eAgjUGhb8Bnd9+7+MRRF1XlcT86RY44AchI OedlMmpNEXW4fgdaMQGWgzOjIpzozSpvgiavNbavRK41ese42NfbRDch6wRgEbU+ GCKXzx03s25KWNamTzvSk2rOy+n1o5LqWnEtrZY= Received: (qmail 31144 invoked by alias); 12 Dec 2016 16:36:37 -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 31109 invoked by uid 89); 12 Dec 2016 16:36:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=conditionally, 22, 18, 2218 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 ESMTP; Mon, 12 Dec 2016 16:36:26 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE9CBC05AA40; Mon, 12 Dec 2016 16:36:24 +0000 (UTC) Received: from localhost (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBCGaOUw008914; Mon, 12 Dec 2016 11:36:24 -0500 Date: Mon, 12 Dec 2016 16:36:23 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Improve tests for contents of header Message-ID: <20161212163623.GM6326@redhat.com> References: <20161207152223.GT6326@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161207152223.GT6326@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) On 07/12/16 15:22 +0000, Jonathan Wakely wrote: >This test for the contents of the header doesn't get run for >C++98 mode and doesn't include the C++14 and C++17 additions. I've >split the C++98-only test into a separate file, and added the new >parts so they're tested conditionally depending on how the test is >run. > > * testsuite/18_support/headers/new/synopsis.cc: Add C++14 and C++17 > declarations. > * testsuite/18_support/headers/new/synopsis_cxx98.cc: New test. > >Tested powerpc64le-linux, committed to trunk. Here's the equivalent for the branches, which doesn't test the C++17 over-aligned allocation functions that are only on trunk. Tested x86_64-linux, committed to gcc-5-branch and gcc-6-branch. commit c6f51ca519e031111b12d28be4f81b91bec5514f Author: redi Date: Wed Dec 7 15:22:24 2016 +0000 Improve tests for contents of header Backport from mainline 2016-12-07 Jonathan Wakely * testsuite/18_support/headers/new/synopsis.cc: Add C++14 declarations and use effective-target to do test for C++11 and later. * testsuite/18_support/headers/new/synopsis_cxx98.cc: New test. diff --git a/libstdc++-v3/testsuite/18_support/headers/new/synopsis.cc b/libstdc++-v3/testsuite/18_support/headers/new/synopsis.cc index f3ed727..63d913b 100644 --- a/libstdc++-v3/testsuite/18_support/headers/new/synopsis.cc +++ b/libstdc++-v3/testsuite/18_support/headers/new/synopsis.cc @@ -1,5 +1,4 @@ -// { dg-do compile } -// { dg-options "-std=gnu++11" } +// { dg-do compile { target c++11 } } // Copyright (C) 2007-2016 Free Software Foundation, Inc. // @@ -22,18 +21,19 @@ namespace std { class bad_alloc; + class bad_array_new_length; struct nothrow_t; extern const nothrow_t nothrow; typedef void (*new_handler)(); - new_handler set_new_handler(new_handler new_p) throw(); new_handler get_new_handler() noexcept; + new_handler set_new_handler(new_handler new_p) noexcept; } -void* operator new(std::size_t size) throw(std::bad_alloc); -void* operator new(std::size_t size, const std::nothrow_t&) throw(); +void* operator new(std::size_t size); +void* operator new(std::size_t size, const std::nothrow_t&) noexcept; void operator delete(void* ptr) throw(); void operator delete(void* ptr, const std::nothrow_t&) throw(); -void* operator new[](std::size_t size) throw(std::bad_alloc); +void* operator new[](std::size_t size); void* operator new[](std::size_t size, const std::nothrow_t&) throw(); void operator delete[](void* ptr) throw(); void operator delete[](void* ptr, const std::nothrow_t&) throw(); @@ -42,3 +42,13 @@ void* operator new (std::size_t size, void* ptr) throw(); void* operator new[](std::size_t size, void* ptr) throw(); void operator delete (void* ptr, void*) throw(); void operator delete[](void* ptr, void*) throw(); + +#if __cplusplus >= 201402L +// C++14 sized deallocation functions +void operator delete(void* ptr, std::size_t size) noexcept; +void operator delete(void* ptr, std::size_t size, + const std::nothrow_t&) noexcept; +void operator delete[](void* ptr, std::size_t size) noexcept; +void operator delete[](void* ptr, std::size_t size, + const std::nothrow_t&) noexcept; +#endif diff --git a/libstdc++-v3/testsuite/18_support/headers/new/synopsis_cxx98.cc b/libstdc++-v3/testsuite/18_support/headers/new/synopsis_cxx98.cc new file mode 100644 index 0000000..2b2abd2 --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/headers/new/synopsis_cxx98.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++98" } +// { dg-do compile } + +// Copyright (C) 2007-2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace std { + class bad_alloc; + struct nothrow_t; + extern const nothrow_t nothrow; + typedef void (*new_handler)(); + new_handler set_new_handler(new_handler new_p) throw(); +} + +void* operator new(std::size_t size) throw(std::bad_alloc); +void* operator new(std::size_t size, const std::nothrow_t&) throw(); +void operator delete(void* ptr) throw(); +void operator delete(void* ptr, const std::nothrow_t&) throw(); +void* operator new[](std::size_t size) throw(std::bad_alloc); +void* operator new[](std::size_t size, const std::nothrow_t&) throw(); +void operator delete[](void* ptr) throw(); +void operator delete[](void* ptr, const std::nothrow_t&) throw(); + +void* operator new (std::size_t size, void* ptr) throw(); +void* operator new[](std::size_t size, void* ptr) throw(); +void operator delete (void* ptr, void*) throw(); +void operator delete[](void* ptr, void*) throw();