From patchwork Tue Jan 31 13:26:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 50935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2817891wrn; Tue, 31 Jan 2023 07:33:45 -0800 (PST) X-Google-Smtp-Source: AK7set/DwK3cSFrf0tpEr4RjuQLUfUzKLqIRuThspEAnmyjdn6xMJAkrbDUuw3h7yADsUjQ7iShf X-Received: by 2002:a17:906:16c8:b0:88a:7037:8562 with SMTP id t8-20020a17090616c800b0088a70378562mr5719843ejd.31.1675179224941; Tue, 31 Jan 2023 07:33:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675179224; cv=none; d=google.com; s=arc-20160816; b=MmM0tceirfEBHHXoDDjY8uFas+PNhPoOI+oLmkooLT037+TaxVU6I96smKnn+H8hCp qwnPs8yRFZvIoc0WY4yg2oQnxi77MFjOnhFlAmQu8da0yAT71I5Ckr4NRln3OJwUQgvE oLr+xEFRzN3PgGr5LvslEB2TDO+2XgW6rPTb1oAUs4/0Jn0IW8O/igh5i5gZ1LoMBmEK nfaBh08Z6i7K+4N0FEpB+Uk0hJMfZHQsnHb8Z+Uf3+bu9xo3P82xP/ltENQezUwiOCJI vxKHtJ1isudBh8vI2LUQDWmppHDe0l6Hc3CFj7qagrvht4z6BkxR7f1Fqf0pYUJpuiGk S6Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=AQR5ypjWhx/IiWO1kzEbf096jX5VSnlQCMZmq1P+Pto=; b=JasBxhvkvTJ/fuB9xId5Q860UL4soIA+N5hMpNNlmj4Ot5Zk5Np4yBeSFCYKYuPp/G LDNM9zzA1TrgWK24XIioEIbllzGtJMEFstx24plrX+TR/Mh9LSONsIj3EwBAvRB8I1hx Wqp8XHi3ls1uRYTqH6b//JKAZ/vx2K5V+6oe4HOU9uNY6QxvDw03pUEF4T8wWM1iox6o dIQQLvWfq4BmVDA2gP0stHIeH4DDJqcVzrSADXsWMsxmd5prsaoUNWOiYd/YnEo/XkKO tUpl/8hQY1akZPOFEgh9aseb/x2805Eulhu8WYXPvOIbkkdxkNvwbvt5hfNpwXRdu5zI hnEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="ghsBi/6j"; 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 up21-20020a170907cc9500b00888c44d9d86si5810644ejc.508.2023.01.31.07.33.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 07:33:44 -0800 (PST) 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="ghsBi/6j"; 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 60B9939507E5 for ; Tue, 31 Jan 2023 13:25:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id D61CF395B429 for ; Tue, 31 Jan 2023 13:22:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D61CF395B429 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-wm1-x333.google.com with SMTP id c10-20020a05600c0a4a00b003db0636ff84so10604131wmq.0 for ; Tue, 31 Jan 2023 05:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=AQR5ypjWhx/IiWO1kzEbf096jX5VSnlQCMZmq1P+Pto=; b=ghsBi/6jdAnqXRypzc5PT7cteTEvfwc16zb6kutyRcdWuVqA6LInzZ/SBaVrwqrZKu NzKNtQsAlbjsqw8iIzHZJ9DvF+6Y6Ma8OfbFRRfvO9pQDbMJILZn8scdpyhrVYDAY8ZU 7KN07E8nvwUTa48uXuJDwMlqbrxVlcKQlLgF02/2HqvtqT36gt6AlBx2t2ZtN6+AqJCl uGETXXUTpyUHrBCBrCf3x610HKTsEeZEwLtzzhGXejyVqk99HfjjB/mVAx+egN01mQGg +rLHgxuiOFkxMOHWsh00FeSNCBNOaGCvQAxONbQWODehLF7NxSKjsptYBEBoXzeuSDo9 u9cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AQR5ypjWhx/IiWO1kzEbf096jX5VSnlQCMZmq1P+Pto=; b=aGE9+TbrjUDWPOujyUYiAYRAUdVTPnw7uwpQ8pbxcAmXLwlbTdj4NkNDxpds3Uw/gv cfgrpT9AIha76PqlStgd+953INOIQfozPJdlgKfX5QqZuOEb3dpwjExUl17M9L2Ugnkh I7IxyfH43PbO5ZzcgOZkrawYQTjJjAtX72Kkl0dz9QL0+fGEQ3um0V+e0OUmdRmJpBC7 mzAe8U/S8N77f78aHn6aM9kfvWfZEGDGxF00mZXUsYtsRalbwUXNheXnFbZEXBzor9Qw rPbSelRDWoFcgRcSveoIB4+xYjKrbCTEkXqCLC5oeRjNWtM9pqp4fxzdLJfcpnrRP+N6 0/ig== X-Gm-Message-State: AO0yUKWp9n8FPsdWZvSgUYLU5guizSVHVs6NkxqU5Z5RKiG+1VwhDTS9 IPrwmNyBSwQ2eL7w+VaV6jzM8/O3BJKOMRhhFg== X-Received: by 2002:a05:600c:4691:b0:3dc:24fc:ef6f with SMTP id p17-20020a05600c469100b003dc24fcef6fmr20719260wmo.40.1675171351221; Tue, 31 Jan 2023 05:22:31 -0800 (PST) Received: from platypus.lan ([2001:861:5e4c:3bb0:6424:328a:1734:3249]) by smtp.gmail.com with ESMTPSA id q17-20020a05600c2e5100b003dd1c45a7b0sm2350740wmf.23.2023.01.31.05.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 05:22:30 -0800 (PST) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [COMMITTED] gccrs: attributes: Add #[macro_use] as builtin Date: Tue, 31 Jan 2023 14:26:16 +0100 Message-Id: <20230131132616.663136-1-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-15.4 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756552730900716396?= X-GMAIL-MSGID: =?utf-8?q?1756552730900716396?= gcc/rust/ChangeLog: * util/rust-attributes.cc: Add `macro_use` to list of builtin attributes. gcc/testsuite/ChangeLog: * rust/compile/macro_export_1.rs: New test. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/rust/util/rust-attributes.cc | 1 + gcc/testsuite/rust/compile/macro_export_1.rs | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 gcc/testsuite/rust/compile/macro_export_1.rs diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc index 9db77b40dfb..1c85273e541 100644 --- a/gcc/rust/util/rust-attributes.cc +++ b/gcc/rust/util/rust-attributes.cc @@ -40,6 +40,7 @@ static const BuiltinAttrDefinition __definitions[] {"no_mangle", CODE_GENERATION}, {"repr", CODE_GENERATION}, {"path", EXPANSION}, + {"macro_use", NAME_RESOLUTION}, // From now on, these are reserved by the compiler and gated through // #![feature(rustc_attrs)] {"rustc_inherit_overflow_checks", CODE_GENERATION}}; diff --git a/gcc/testsuite/rust/compile/macro_export_1.rs b/gcc/testsuite/rust/compile/macro_export_1.rs new file mode 100644 index 00000000000..f87df083624 --- /dev/null +++ b/gcc/testsuite/rust/compile/macro_export_1.rs @@ -0,0 +1,2 @@ +#[macro_use] +mod foo {}