From patchwork Thu Apr 25 11:46:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1927714 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DVImRiTo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VQDbj6CgRz1yZr for ; Thu, 25 Apr 2024 21:46:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 58EDA3846410 for ; Thu, 25 Apr 2024 11:46:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E45343846410 for ; Thu, 25 Apr 2024 11:46:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E45343846410 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E45343846410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714045593; cv=none; b=v5vT/LTelsfqx3P8J2ugYey9t77iFd7+mO2c5itlrerMVxiJPNR5PwRLSAfUqNyfr6rVwFYiYjqXctR7F7ZoIF5XQ4qfuo9GqvPnZ9uysKx5LPqcFIsD6/M0xmj1aQBDa90L9SOS20G1kPlly4HtrAJrh3STd/hOy8hZnXjJevc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714045593; c=relaxed/simple; bh=MLc503DZvsF0J1nQybydq0iVhamdsjIgc/f+GOTfk5w=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=mjKOOQRMzouxEQVa4tk93Bn669tPG+VBoioSMiqLodIUeto/R8Ik8/82oFceyUvwR9UMRl+THsl9GWAsE+lYNcrUVqGi8AUKKhAgPrJSFjyeyp246NzWhSP1D958N0Lv7pmktqQqOUYqB7KWrVwUdUAh0e8+woW8EuUvaVswtrc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714045591; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=MJXHC5eUwePmGAHaWaXDArro6PDSnr2RSo84Xi/xscM=; b=DVImRiTon/KbhkIqy+t5NnJlYEzFKTAorQ5pTWso6mL+EHzzCX2OxLvOpBux8F/CJlXqU/ Ung4fppNsU2dJ844Zcwv7Irh04TXx2/FDHSqlqk75oYhICKC0bcbLS5rH0p1/jmyBVTpcA NDpiULI7gwCv8qKlRmhp5ZhbMk2k8WQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-253-hU8NINeDPbKFGIswWcigsQ-1; Thu, 25 Apr 2024 07:46:29 -0400 X-MC-Unique: hU8NINeDPbKFGIswWcigsQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B22C6800935 for ; Thu, 25 Apr 2024 11:46:29 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7460640F01A; Thu, 25 Apr 2024 11:46:29 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 43PBkR7A3844182 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 13:46:27 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 43PBkRJ13844181; Thu, 25 Apr 2024 13:46:27 +0200 Date: Thu, 25 Apr 2024 13:46:27 +0200 From: Jakub Jelinek To: "Joseph S. Myers" Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] libcpp: Adjust __STDC_VERSION__ for C23 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! While the C23 standard isn't officially release yet, in 2011 we've changed __STDC_VERSION__ value for C11 already in the month in which the new __STDC_VERSION__ value has been finalized, so we want to change this now or wait until we implement all the C23 features? Note, seems Clang up to 17 also used 202000L for -std=c2x but Clang 18+ uses 202311L as specified in the latest C23 drafts. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-04-25 Jakub Jelinek * init.cc (cpp_init_builtins): Change __STDC_VERSION__ for C23 from 202000L to 202311L. * doc/cpp.texi (__STDC_VERSION__): Document 202311L value for -std=c23/-std=gnu23. Jakub --- libcpp/init.cc.jj 2024-01-03 12:07:27.552378565 +0100 +++ libcpp/init.cc 2024-04-24 23:54:32.613204591 +0200 @@ -594,7 +594,7 @@ cpp_init_builtins (cpp_reader *pfile, in _cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L"); else if (CPP_OPTION (pfile, lang) == CLK_STDC23 || CPP_OPTION (pfile, lang) == CLK_GNUC23) - _cpp_define_builtin (pfile, "__STDC_VERSION__ 202000L"); + _cpp_define_builtin (pfile, "__STDC_VERSION__ 202311L"); else if (CPP_OPTION (pfile, lang) == CLK_STDC17 || CPP_OPTION (pfile, lang) == CLK_GNUC17) _cpp_define_builtin (pfile, "__STDC_VERSION__ 201710L"); --- gcc/doc/cpp.texi.jj 2024-01-03 11:38:23.583695795 +0100 +++ gcc/doc/cpp.texi 2024-04-25 00:28:08.144182645 +0200 @@ -1886,8 +1886,8 @@ the 1999 revision of the C standard; the signifies the 2011 revision of the C standard; the value @code{201710L} signifies the 2017 revision of the C standard (which is otherwise identical to the 2011 version apart from correction of -defects). An unspecified value larger than @code{201710L} is used for -the experimental @option{-std=c23} and @option{-std=gnu23} modes. +defects). The value @code{202311L} is used for the experimental +@option{-std=c23} and @option{-std=gnu23} modes. This macro is not defined if the @option{-traditional-cpp} option is used, nor when compiling C++ or Objective-C@.