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: 711294 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 3tvMsG0CRkz9t1B for ; Thu, 5 Jan 2017 20:32:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FR2Olhnv"; 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:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=h6l6WZvvCraknjgEwPhO2x81kduvmG1A8tRvOGBNEydxTBAfD5 FU9jCyCb0g/aufIu/uMQmojD/jR/BYly1wgX63mDxk16rxsZmNrAMZA93gKCXmbN 7o7gZ0du8e/WuF+b4XIJ9ivDFW+RzSg02I7WSuQYFR4bOsWO3/eZju7cI= 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=FR2Olhnv2iIU1LOkfRD+ cw5e/CF1r5s1Z3Ojbqu5vZxJEQjFdhfv2bUIVNp0QRQZcfoNnyCIOJp733ahOK8p 16CBn0KBhfaNIaqsnynHia5uae7Fr13XbK29/aA82OBWuuMDLqggdFcU9HUMY+T2 mgHARgdbR5tq6bzhvauZ1iE= 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 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"); \