From patchwork Fri Jun 15 15:52:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 930073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-479817-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="HSOD4whN"; dkim-atps=neutral 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 416lPl4BfBz9s2L for ; Sat, 16 Jun 2018 01:52:59 +1000 (AEST) 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=GCEAkyQErHxleV7MYQYr7BKwp7P4EnjqbHgCSZi1cm9HyZhQnO 9Tp/NL2g+D34PHqBpQwfQKjhcdZ4Q98PKUy6u6zmq7iKc+KwAXbIgVzZj+fRG58A JaeiE0/GFIHoCtBeN7Kh3SB+x9EnnLcpUbK7RZwS3qkhCAip9i5sWtxVs= 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=QTjbIBa+wJreP2tk4E1/iN0QUa8=; b=HSOD4whNWa4LaBNAUd7i h93ypol/jJp48099NIdG0M/7lVummCZxaWg+ifLwppvZRqZcup+4Yt1hKN0fSzrJ XK24hcnFIZLmnDcdZ9bQwuWILCt3JmApjahx1nyEkwUKD3q9dp0j0TbiS2clWwhG Gr4nVhC6z4R1GxD+EnPYYXM= Received: (qmail 46741 invoked by alias); 15 Jun 2018 15:52:44 -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 46721 invoked by uid 89); 15 Jun 2018 15:52:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=201402l, 201402L X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Jun 2018 15:52:41 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B19280125D6; Fri, 15 Jun 2018 15:52:40 +0000 (UTC) Received: from localhost (unknown [10.33.36.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1090110FD2A7; Fri, 15 Jun 2018 15:52:39 +0000 (UTC) Date: Fri, 15 Jun 2018 16:52:39 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Subject: RFC: What should go in our header? Message-ID: <20180615155239.GT6295@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.2 (2017-12-15) C++20 adds a header, which should define all the library feature test macros, as well as implementation-specific macros like _GLIBCXX_RELEASE and __GLIBCXX__. We should decide whether to implement by simply including and then adding the feature test macros, or if we should keep it minimal and *only* define _GLIBCXX_RELEASE and __GLIBCXX__ and the feature tests (and then have include ?) I think I prefer to make just include . I think we should define the feature-test macros in both and the relevant header (e.g. __cpp_string_view in ). We could make everything include and then every header would define every feature test macro, but I don't think that's good for portability. My preference is implemented by the attached patch. While on the subject, should we just delete some of this autoconf-junk from our c++config.h headers? /* Name of package */ /* #undef _GLIBCXX_PACKAGE */ /* Define to the address where bug reports for this package should be sent. */ #define _GLIBCXX_PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define _GLIBCXX_PACKAGE_NAME "package-unused" /* Define to the full name and version of this package. */ #define _GLIBCXX_PACKAGE_STRING "package-unused version-unused" /* Define to the one symbol short name of this package. */ #define _GLIBCXX_PACKAGE_TARNAME "libstdc++" /* Define to the home page for this package. */ #define _GLIBCXX_PACKAGE_URL "" /* Define to the version of this package. */ #define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused" commit f432c0d29f9db3b0f40d34f52f32936a2d24fbb8 Author: Jonathan Wakely Date: Fri Jun 15 15:35:38 2018 +0100 P0754R2 header * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/c++config: Change doxygen comment to suggest instead of . * include/std/version: New header. diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 77e6dc2f6be..f91907df325 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -80,7 +80,8 @@ std_headers = \ ${std_srcdir}/utility \ ${std_srcdir}/valarray \ ${std_srcdir}/variant \ - ${std_srcdir}/vector + ${std_srcdir}/vector \ + ${std_srcdir}/version bits_srcdir = ${glibcxx_srcdir}/include/bits bits_builddir = ./bits diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 838afc59dfb..a9243888e60 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -24,7 +24,7 @@ /** @file bits/c++config.h * This is an internal header file, included by other library headers. - * Do not attempt to use it directly. @headername{iosfwd} + * Do not attempt to use it directly. @headername{version} */ #ifndef _GLIBCXX_CXX_CONFIG_H diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version new file mode 100644 index 00000000000..61d85b7b80f --- /dev/null +++ b/libstdc++-v3/include/std/version @@ -0,0 +1,131 @@ +// -*- C++ -*- Libstdc++ version details header. + +// Copyright (C) 2018 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. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file version + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + */ + +#ifndef _GLIBCXX_VERSION_INCLUDED +#define _GLIBCXX_VERSION_INCLUDED + +#pragma GCC system_header + +#include + +// c++03 +#define __cpp_lib_incomplete_container_elements 201505 + +#if !defined(__STRICT_ANSI__) +// gnu++03 +# define __cpp_lib_uncaught_exceptions 201411 +#endif + +#if __cplusplus >= 201103L +// c++11 +#define __cpp_lib_allocator_is_always_equal 201411 +#define __cpp_lib_allocator_traits_is_always_equal 201411 +#define __cpp_lib_is_null_pointer 201309 +#define __cpp_lib_result_of_sfinae 201210 +#define __cpp_lib_shared_ptr_arrays 201603 + +#if !defined(__STRICT_ANSI__) +// gnu++11 +# define __cpp_lib_enable_shared_from_this 201603 +# define __cpp_lib_is_swappable 201603 +# define __cpp_lib_void_t 201411 +#endif + +#if __cplusplus >= 201402L +// c++14 +#define __cpp_lib_chrono_udls 201304 +#define __cpp_lib_complex_udls 201309 +#define __cpp_lib_exchange_function 201304 +#define __cpp_lib_generic_associative_lookup 201304 +#define __cpp_lib_integer_sequence 201304 +#define __cpp_lib_integral_constant_callable 201304 +#define __cpp_lib_is_final 201402L +#define __cpp_lib_make_reverse_iterator 201402 +#define __cpp_lib_make_unique 201304 +#define __cpp_lib_quoted_string_io 201304 +#define __cpp_lib_robust_nonmodifying_seq_ops 201304 +#define __cpp_lib_shared_timed_mutex 201402 +#define __cpp_lib_string_udls 201304 +#define __cpp_lib_transformation_trait_aliases 201304 +#define __cpp_lib_transparent_operators 201510 +#define __cpp_lib_tuple_element_t 201402L +#define __cpp_lib_tuples_by_type 201304 + +#if __cplusplus >= 201703L +// c++17 +#define __cpp_lib_addressof_constexpr 201603 +#define __cpp_lib_apply 201603 +#define __cpp_lib_array_constexpr 201603 +#define __cpp_lib_as_const 201510 +#define __cpp_lib_atomic_is_always_lock_free 201603 +#define __cpp_lib_bool_constant 201505 +#define __cpp_lib_boyer_moore_searcher 201603 +#define __cpp_lib_byte 201603 +#define __cpp_lib_chrono 201611 +#define __cpp_lib_clamp 201603 +#define __cpp_lib_constexpr_char_traits 201611 +#define __cpp_lib_enable_shared_from_this 201603 +#define __cpp_lib_filesystem 201703 +#define __cpp_lib_gcd 201606 +#define __cpp_lib_gcd_lcm 201606 +#define __cpp_lib_has_unique_object_representations 201606 +#define __cpp_lib_hypot 201603 +#define __cpp_lib_invoke 201411 +#define __cpp_lib_is_aggregate 201703 +#define __cpp_lib_is_invocable 201703 +#define __cpp_lib_is_swappable 201603 +#define __cpp_lib_launder 201606 +#define __cpp_lib_lcm 201606 +#define __cpp_lib_logical_traits 201510 +#define __cpp_lib_make_from_tuple 201606 +#define __cpp_lib_map_insertion 201411 +#define __cpp_lib_map_try_emplace 201411 +#define __cpp_lib_math_special_functions 201603L +#define __cpp_lib_node_extract 201606 +#define __cpp_lib_nonmember_container_access 201411 +#define __cpp_lib_not_fn 201603 +#define __cpp_lib_optional 201603 +#define __cpp_lib_sample 201603 +#define __cpp_lib_scoped_lock 201703 +#define __cpp_lib_shared_mutex 201505 +#define __cpp_lib_shared_ptr_weak_type 201606 +#define __cpp_lib_string_view 201603 +#define __cpp_lib_type_trait_variable_templates 201510L +#define __cpp_lib_unordered_map_insertion 201411 +#define __cpp_lib_unordered_map_try_emplace 201411 +#define __cpp_lib_void_t 201411 + +#if __cplusplus > 201703L +// c++2a +#endif // C++2a +#endif // C++17 +#endif // C++14 +#endif // C++11 + +#endif // _GLIBCXX_VERSION_INCLUDED