From patchwork Thu Jan 5 09:31:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 89974 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8881078qgi; Thu, 5 Jan 2017 01:32:25 -0800 (PST) X-Received: by 10.98.223.25 with SMTP id u25mr65254732pfg.96.1483608745650; Thu, 05 Jan 2017 01:32:25 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id p3si66264217pli.181.2017.01.05.01.32.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2017 01:32:25 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445434-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-445434-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445434-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:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=rdtq50Zyfn217M1nXYgIlmZ+1zQtJbcfXaexs8OjIlGJEIQh4j e4VJbwAI17Nz4s3pLJFF1dnhM7Hz63nT5IEVRU63yYJDAqWoQUWA0pI6kd74H1XX QeQIkBrsvtadS6d443PKWtNNJdnw90lEXDD/ZM7Ze00K7LS2rveQ/Po28= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=xvmiRM81gaBitAX4YHsxLn59P2A=; b=Se451mRYXOPYUjIAD0/4 gZOHUOLt6cVlZyxIvZlBYqx4WOYV+Xep2KwtVB8KrHO7JYEaJHH4ViuV1ObIzo+Z idIw28v6gRhpUZFISeIsknhQ4PHbKfX3IVfYxkLD57chKntH+0lBzoFTUpH8k8MG yIeHWaKuNk/y5IO0EdKcKgc= Received: (qmail 45199 invoked by alias); 5 Jan 2017 09:31:35 -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 44501 invoked by uid 89); 5 Jan 2017 09:31:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jan 2017 09:31:24 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id D841D165; Thu, 5 Jan 2017 10:31:21 +0100 (CET) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cv9ZtbWKBpJ2; Thu, 5 Jan 2017 10:31:20 +0100 (CET) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 34FFF164; Thu, 5 Jan 2017 10:31:20 +0100 (CET) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id v059VJ1v008748; Thu, 5 Jan 2017 10:31:19 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Jonathan Wakely Subject: Require C11 for C++17 on Solaris Date: Thu, 05 Jan 2017 10:31:19 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes While investigating PR libstdc++/78979, it turned out that g++ on Solaris should define the C11 value for __STDC_VERSION__ instead of the C99 one when compiling for C++17. That's what this patch does. It seemed safer to use the C99 value only where we know it's needed, and default to the C11 one to be future-proof for versions of C++ beyond 2017. Bootstrapped without regressions on i386-pc-solaris2.1[10] and sparc-sun-solaris2.12 (together with the soon-to-be-submitted patch for the PR itself). Unless Jon or someone else finds fault with the approach, I plan to commit it to mainline soon. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2017-01-04 Rainer Orth * config/sol2.h (TARGET_OS_CPP_BUILTINS): Define __STDC_VERSION__ to 201112L since C++17. diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -94,7 +94,22 @@ along with GCC; see the file COPYING3. library. */ \ if (c_dialect_cxx ()) \ { \ + switch (cxx_dialect) \ + { \ + case cxx98: \ + case cxx11: \ + case cxx14: \ + /* C++11 and C++14 are based on C99. \ + libstdc++ makes use of C99 features \ + even for C++98. */ \ builtin_define ("__STDC_VERSION__=199901L");\ + break; \ + \ + default: \ + /* C++17 is based on C11. */ \ + builtin_define ("__STDC_VERSION__=201112L");\ + break; \ + } \ builtin_define ("_XOPEN_SOURCE=600"); \ builtin_define ("_LARGEFILE_SOURCE=1"); \ builtin_define ("_LARGEFILE64_SOURCE=1"); \