From patchwork Thu Aug 1 15:17:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 95091 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 06F75384DD00 for ; Thu, 1 Aug 2024 15:45:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 003D63861004 for ; Thu, 1 Aug 2024 15:18:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 003D63861004 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 003D63861004 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525534; cv=none; b=GTQtcaWux5mmZ1gpejbCmInaLXUePmiFtdIz+q9bE+R32zFyG7lR7ds7jjZ9vqUYRabmvuEgvJHk7ftkOMuCXzptLAJSXOzSGeYtFqx+WuOiCoYKexeh+f3AgCaVUD53Bou3n42iaR76nZ40fUgKR4lxBILyuGP00U1B/ywSd6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525534; c=relaxed/simple; bh=WEWAnnkr/qRZEh6qXp+ajMtiZS7NixLLZE31jI83hrM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=A0QpQl6eFKEdOWr/I9jTBCY4BNB5M0zwR9WPF4I0UDPs0IxEWD9x9kDbSdHXBa/LH7YeH6LFPanxcu6fGGVPu67BvkgyR1B3cqfEuUCf6bA0dUIBLpapBmhJYbXYP95w4zQ28B8/e1wmtXJViaThoB00kaGNdvEYJV7veRQqwlM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-368526b1333so1393370f8f.1 for ; Thu, 01 Aug 2024 08:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1722525510; x=1723130310; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nRzdxIa/QA0NdijEJN3jUJ6NKQlyBd0dtQugTdfWTC0=; b=iWAqvrXmD1RssZ7YKMUJodEdgujctOPedy/UzroCas1M8eVyYX1fUO6tbATti0hS0W TG28LaZgmRdRFViDUOPbnwKgYH/D44XrZ5p4f/7PfC58Ak0u9vsS4qGLw8+NTETdtejW jDuB2DsR7co+WYT2CB1OJJXlcZW9QJ7+z5FPrClQYKgt4P2ZWmrME1wFXUJZvbwfM1eS ttehzhDK4N3+3+xpGjhl8lxpbyXaL+KyYCWrMEY0Wg7c/LF44mzjShdB/j4O/G9cb2YF 72P8FC+udGva34lxvf38ZQUVDfO3X0hbYzDL7CQkZFUnj+E0/gjpFj7sqUon8uLjZLJO +05g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722525510; x=1723130310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nRzdxIa/QA0NdijEJN3jUJ6NKQlyBd0dtQugTdfWTC0=; b=ChWnJAh+zj7naev59fJgscdmKfYw8LNcAD0D4Mq04XF3mIjAEVLWrr2VqYnAIuMi4m FUZ+nWHFw1EYCKbgMIIKQRkbVZVTwLIjY0uBanbMZgnolRSw1Az8hZvp6OWrfw1BC+4y aEFfEd3oLFwTEI+VuOlvE38Hmckwh/iDHfQnj+I+FncZeapoktm4uF9+9Gg5PmYh2wso WAB2aGYUg2hBX3WL/aMMPwpmDQm+WvSBzRGwvPJ22JVnobjsyUHDi5zQWwJShMQmj/8S oLIoQK8WqY7CeDYLH4rp0YveKxNRvVzKbMYUfy38HVWbKfY4TJwPoPGEX3amGUedItnL 9M8A== X-Gm-Message-State: AOJu0YwUn3OO0eDlpw4mkaA1FE3wbR2gcUOPv8Q6c4hE4Q4WtAuKfwdA Jcz+OzwE5G+ltx37Q+B0sLf1CJJgczIMaLJ5w7xG9nyyQxg+yHNYWUrLLaAuK8etRbu2LthbIwv Q1w== X-Google-Smtp-Source: AGHT+IFbOn/XBH6zXLq/uPDEcPuzaorRZ7gq7oAEXoBHOwxRzEGizRKexC7rWw5LUc4lqQNvECrwkg== X-Received: by 2002:a5d:6d0f:0:b0:367:940b:b662 with SMTP id ffacd0b85a97d-36bbbeefe1cmr321779f8f.31.1722525509560; Thu, 01 Aug 2024 08:18:29 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:b6aa:4751:9ea1:da1e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36857fdesm20065995f8f.75.2024.08.01.08.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 08:18:29 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED 23/30] ada: Restrict string interpolation to single string literal Date: Thu, 1 Aug 2024 17:17:31 +0200 Message-ID: <20240801151738.400796-23-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801151738.400796-1-poulhies@adacore.com> References: <20240801151738.400796-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Javier Miranda gcc/ada/ * par-ch2.adb (P_Interpolated_String_Literal): remove support of multi-line string literals. * doc/gnat_rm/gnat_language_extensions.rst: Update documentation. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/gnat_language_extensions.rst | 16 ++-------------- gcc/ada/gnat_rm.texi | 16 ++-------------- gcc/ada/par-ch2.adb | 12 ++---------- 3 files changed, 6 insertions(+), 38 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst index feceff24e21..0f001c4aca9 100644 --- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst +++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst @@ -323,20 +323,8 @@ For example: f" a double quote is \" and" & f" an open brace is \{"); -Finally, a syntax is provided for creating multi-line string literals, -without having to explicitly use an escape sequence such as ``\n``. For -example: - -.. code-block:: ada - - Put_Line - (f"This is a multi-line" - "string literal" - "There is no ambiguity about how many" - "spaces are included in each line"); - -Here is a link to the original RFC : -https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.rst +Link to the original RFC: +https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.md Constrained attribute for generic objects ----------------------------------------- diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 24c2fdd4f97..b27bd627c17 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -29223,20 +29223,8 @@ Put_Line f" an open brace is \@{"); @end example -Finally, a syntax is provided for creating multi-line string literals, -without having to explicitly use an escape sequence such as @code{\n}. For -example: - -@example -Put_Line - (f"This is a multi-line" - "string literal" - "There is no ambiguity about how many" - "spaces are included in each line"); -@end example - -Here is a link to the original RFC : -@indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.rst} +Link to the original RFC: +@indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.md} @node Constrained attribute for generic objects,Static aspect on intrinsic functions,String interpolation,Curated Extensions @anchor{gnat_rm/gnat_language_extensions constrained-attribute-for-generic-objects}@anchor{448} diff --git a/gcc/ada/par-ch2.adb b/gcc/ada/par-ch2.adb index f09daeaba69..f249ae76023 100644 --- a/gcc/ada/par-ch2.adb +++ b/gcc/ada/par-ch2.adb @@ -224,7 +224,6 @@ package body Ch2 is function P_Interpolated_String_Literal return Node_Id is Elements_List : constant List_Id := New_List; - NL_Node : Node_Id; Saved_State : constant Boolean := Inside_Interpolated_String_Literal; String_Node : Node_Id; @@ -258,15 +257,8 @@ package body Ch2 is T_Right_Curly_Bracket; end; else - if Prev_Token = Tok_String_Literal then - NL_Node := New_Node (N_String_Literal, Token_Ptr); - Set_Has_Wide_Character (NL_Node, False); - Set_Has_Wide_Wide_Character (NL_Node, False); - - Start_String; - Store_String_Char (Get_Char_Code (ASCII.LF)); - Set_Strval (NL_Node, End_String); - Append_To (Elements_List, NL_Node); + if Prev_Token /= Tok_Right_Curly_Bracket then + Error_Msg_SC ("unexpected string literal"); end if; Append_To (Elements_List, Token_Node);