Message ID | 20230405140411.3016563-79-arthur.cohen@embecosm.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp367837vqo; Wed, 5 Apr 2023 07:55:40 -0700 (PDT) X-Google-Smtp-Source: AKy350asDizo+MXzUQ+ttR7kiTNdIfYaB2gUX0p3J6IxavPLZKwebNK55NpFoo3aaQ1ZS3GxvWcL X-Received: by 2002:a17:906:198e:b0:92f:de0d:104b with SMTP id g14-20020a170906198e00b0092fde0d104bmr3277002ejd.9.1680706539927; Wed, 05 Apr 2023 07:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680706539; cv=none; d=google.com; s=arc-20160816; b=HjlfILFgKxMqoOrAH9vfA+b51n64evdGQAdm1yyXK4betFNzb+9jg+pA4RvY3dK1Qp kpo7Wia5Qza3D1LBw1qwUFUn5H8aDscsjJ0rtN8OmDNlmCEigQXVDQwbIabK80FPcbuO Pf/pg8KUbzF73suyEXclMkHj1C6qEZNFB5TABMAHXT0moDibJD4wRTJcAR6BijeaXuvA 01O+DPxk8G8hpJNHTssW/bN7siqQsP8ITIcTFCQThBlsGfclTF9weXJuivb33C+K1C3e 6C/dtL3w6x4zivUGsK0HARk0XHS69ukHSjbvQsyv/X8w+nDSM/TML2l23zSqbooSsm0l bNnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=ZJGzI+1+8dpVv/ULvDh1J2DnRrWjTQOcHB2rF70bhBw=; b=aRyx6MfTZefN/kT4UTf3a3ZP+4sHsUDPWhjlgQtEqHcugeMFKa1kFBsKfuGJzBComj ZTx55ZW4Pbr3g2217f+UnpiVj0QhdzV/onyWmwI6sAvQF1I5FjCiT9joWa41anK/VcCs QVstGSOQ1yxEBJ0x5IgKyk6eafdVOY3VjTplvJd8cFUdWjYRjWgu/IcjYgdUiyRZdWtY DilD1j3lEw38tWftjSeF0HKF8JHaKZli60IAbL9syGoakHqLAjPFMycSyGbe+hWbgD79 9ih5NQkp7sMLAttr6nUT2Uv9cOzV+i+crfx3C4yNX5Xm0iB+QqV0j3gJtZaVSUwlo04i xA3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=GVpKDNxL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r16-20020a170906a21000b0092be4b3c198si12221512ejy.662.2023.04.05.07.55.39 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:55:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=GVpKDNxL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8E031382C15D for <ouuuleilei@gmail.com>; Wed, 5 Apr 2023 14:20:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 61465388203D for <gcc-patches@gcc.gnu.org>; Wed, 5 Apr 2023 14:06:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61465388203D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42c.google.com with SMTP id v1so36338008wrv.1 for <gcc-patches@gcc.gnu.org>; Wed, 05 Apr 2023 07:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703583; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=ZJGzI+1+8dpVv/ULvDh1J2DnRrWjTQOcHB2rF70bhBw=; b=GVpKDNxLoimU7ID2QG4rZHqSaf2otqDhgXmXvtNFuv9tSmEBIERuB6dfaTpGNtn/wh lgK6afjAPrrXLDIch2/PAT+FQuL/lyOsP2OCG0E8mpSlIty7IKb8G9CVtrihqDLkpOuL BBYAQ1uFjwG7SVS6gqY4IZzvtUEpxGPSgvb5extuRKV4qdom69vnVbLUzk9EpSK2RqZP zC7YuaQ1nGOWDn2mwQHQevonPLPBXLaoycPR2aB8LFFcwYn3r+OL5V75PUs1CmWENwZC msK6WzO5ZOHt/2rNKRb0ONRyhEr5GaT9HMVC6DVmdfEUo7qHasi0BNqz3DldqPBqrWFT mp0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703583; h=content-transfer-encoding:mime-version:reply-to: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=ZJGzI+1+8dpVv/ULvDh1J2DnRrWjTQOcHB2rF70bhBw=; b=ykee2g0NnXvWNjebsj0aHWa/yaGVk2FafryU6ez7ruiLuMnqeHSBRTXhPPFvEIihFX aNQPZXh37RGwKstc3wJ5ybCemRSSkuS2c/kKL7n8fU1st/zqyePeicvPNtjO1A+Qtwuk YRIa6x90KfmAHcQMIZn2jQMLuLZlDgz7irHi9emoTZBkNUbPG9vTF9OLYWKLpJTb1h+8 P/arqK8lIj1o/s+Sti4NUp2ikzMDhirt8unSp6J1Ysc68BpykAZmo8r6sXavqewR6Cju GSu2wusE42mzpaw0eirbu2OgSFjYIH8FvENMOZFYkwyAABx9q2SoVd2RUJEVvOG+i1Qu Otlg== X-Gm-Message-State: AAQBX9cjS5AgKNQ8x5NjQ12ejUyPqgymAYv4GahXW2PvAGDqPu8K05Ch ES1UmbLFo4zn2ZkAJDOlcSEVLxXjRSyVh0obNg== X-Received: by 2002:adf:cf09:0:b0:2d6:adfe:cea5 with SMTP id o9-20020adfcf09000000b002d6adfecea5mr4067907wrj.68.1680703582853; Wed, 05 Apr 2023 07:06:22 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:06:22 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen <arthur.cohen@embecosm.com> Subject: [committed 78/88] gccrs: builtins: Return empty list of tokens instead of nullptr Date: Wed, 5 Apr 2023 16:04:02 +0200 Message-Id: <20230405140411.3016563-79-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405140411.3016563-1-arthur.cohen@embecosm.com> References: <20230405140411.3016563-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.2 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=unavailable 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.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762348540631065633?= X-GMAIL-MSGID: =?utf-8?q?1762348540631065633?= |
Series |
[committed,01/88] gccrs: fatal_error_flag: Fix typo in error message
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Arthur Cohen
April 5, 2023, 2:04 p.m. UTC
From: Arthur Cohen <arthur.cohen@embecosm.com>
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc (MacroBuiltin::include_handler): Do not
return nullptr token in expansion of `include!()`
gcc/testsuite/ChangeLog:
* rust/compile/empty.in: New test.
* rust/compile/include_empty.rs: New test.
---
gcc/rust/expand/rust-macro-builtins.cc | 15 +++++++++++++--
gcc/testsuite/rust/compile/empty.in | 1 +
gcc/testsuite/rust/compile/include_empty.rs | 8 ++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/rust/compile/empty.in
create mode 100644 gcc/testsuite/rust/compile/include_empty.rs
diff --git a/gcc/rust/expand/rust-macro-builtins.cc b/gcc/rust/expand/rust-macro-builtins.cc index 3b6f69bbd69..97594921dec 100644 --- a/gcc/rust/expand/rust-macro-builtins.cc +++ b/gcc/rust/expand/rust-macro-builtins.cc @@ -752,8 +752,19 @@ MacroBuiltin::include_handler (Location invoc_locus, AST::MacroInvocData &invoc) nodes.push_back (node); } - // FIXME: Do not return an empty token vector here - return AST::Fragment (nodes, nullptr); + // FIXME: This returns an empty vector of tokens and works fine, but is that + // the expected behavior? `include` macros are a bit harder to reason about + // since they include tokens. Furthermore, our lexer has no easy way to return + // a slice of tokens like the MacroInvocLexer. So it gets even harder to + // extrac tokens from here. For now, let's keep it that way and see if it + // eventually breaks, but I don't expect it to cause many issues since the + // list of tokens is only used when a macro invocation mixes eager + // macro invocations and already expanded tokens. Think + // `concat!(a!(), 15, b!())`. We need to be able to expand a!(), expand b!(), + // and then insert the `15` token in between. In the case of `include!()`, we + // only have one argument. So it's either going to be a macro invocation or a + // string literal. + return AST::Fragment (nodes, std::vector<std::unique_ptr<AST::Token>> ()); } AST::Fragment diff --git a/gcc/testsuite/rust/compile/empty.in b/gcc/testsuite/rust/compile/empty.in new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/gcc/testsuite/rust/compile/empty.in @@ -0,0 +1 @@ + diff --git a/gcc/testsuite/rust/compile/include_empty.rs b/gcc/testsuite/rust/compile/include_empty.rs new file mode 100644 index 00000000000..28e940fa0ac --- /dev/null +++ b/gcc/testsuite/rust/compile/include_empty.rs @@ -0,0 +1,8 @@ +#[rustc_builtin_macro] +macro_rules! include { + () => {}; +} + +include!("empty.in"); + +fn main() {}