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: 705091 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 3tcpQ63Shbz9s5w for ; Tue, 13 Dec 2016 03:36:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xxqaVHjI"; 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:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=EcWopuZ0W9r+wI4h6ety2MOEEuqz5I y09I7acD6g+yNDKG4y9TGQk5xYTzRuGi4b9QYhB1C2rxsUE/QjjKwE7O4hpevuU4 HVfG/wf2crFk5QpLf6HFo3XU9CRCeIQi145SmQKwEMvOhzdBnllOMpTEo3tuXCRv kVVKAGBSUXesU= 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=xxqa VHjIYYYqdWTNrWC0CgRs73dLRxwC/vTuGMr6SOq/ZM1ZKq7TDrzeJtkjUGVtVUgB tt/qkNkVot3b24fnIJO2YeRnTGEsRjIDla1p38qXspX+klg3sKcdIMVt8BofASFS SoiB4XtPebAUV4rXRjkmPb9x37R0DkNprief+HM= 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();