From patchwork Wed Oct 26 08:18:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 11153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp136842wru; Wed, 26 Oct 2022 01:51:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZW85wV3WffFeaMjg7KkCuYbSQW0ZcWWankpXP7oR89ALJUFtitqaO8uKIEmnDLSjHwafj X-Received: by 2002:a17:907:1c8a:b0:782:1a0d:3373 with SMTP id nb10-20020a1709071c8a00b007821a0d3373mr35136335ejc.135.1666774302844; Wed, 26 Oct 2022 01:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666774302; cv=none; d=google.com; s=arc-20160816; b=yvxH/JqnIkIRf0Um3z+5VPpvLVBDKrHjujW8Jpsl8PHIdqspyLrOYWBrRjuhA7biJM Sh/UwcFv4o+pMcIGVAZTH4RPBqLfdoE2gxvMHtfAbw6+xOC+bAyvPPMJBdFxnZmwH8a/ kVGcHME3xkcb1h+dnEN6Njsa45xN8XAm2sqoG+XWFADCTa8GtBP67AJ8X1wXIf19ND6K gD1Ki/yg8jFl5Jrm4HHzVBbSj9yGCp2+YMl2Y4ThS7xk08VztVCR0lAiN4rDFf0nR0UE qq+nE3aTyR09JwXLrLJ/Ea99mxJ3yjeCa/crbW6w4WIGdtNdfnnkzJkI4U4y2SwMmheG bnwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from:dkim-signature:dmarc-filter :delivered-to; bh=pZziygPhjGhkMxsngfQBS+7si9TJ9jL3ZOgNpCiIOYY=; b=TOVIMv8sDZphOSS8nu3rWsdTnFklNvs1UQvLTp0wd9hdRdK3XL90jsEtuYiov+KuYt DZ8lsHKGOyR0E5niXbnGxLFm96QmH26qViRcWuEVNAMEQAXjrAvrAEARJQy24e49920F 0WidEx5L/xEXXw9xsVK67/RVqPMxUgTzhmTwFEjUABiNWr2OcLEW2PJOVZNNH2zeE9U9 /Tb4u3OjYCBhgKqWriyfUJdeLFoNvRARgR0fgUJ4tPN0idISq2ApDxcBvKSq91i4U8iA dp544Dtm2NblwlvT1v8zpKHqZRKX4+H9tB2BPkiGM+EuYbiMNFch4qp4ytoRzCE3Qd5q WURg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=g9YtKLWP; 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 gb23-20020a170907961700b0078c5d28e27esi5245495ejc.604.2022.10.26.01.51.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 01:51:42 -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=g9YtKLWP; 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 C28E0383FBB9 for ; Wed, 26 Oct 2022 08:38:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id A0D7A3846446 for ; Wed, 26 Oct 2022 08:16:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0D7A3846446 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-x32e.google.com with SMTP id y10so9699068wma.0 for ; Wed, 26 Oct 2022 01:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; 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=pZziygPhjGhkMxsngfQBS+7si9TJ9jL3ZOgNpCiIOYY=; b=g9YtKLWPNVXJYb8e5CDiycTmLbavEVI6h53m0EyggbuEzD4tO+teUNvBPg4BO+HjQC aJ+xuLqw/xa1lnkZC7QE7u4X27tMcxYPn0wy4FScZcvlfi9UWT7eJcnuRDLb2k0PyRvD BtigYEvmjztnB6JeUHHUcmfQFdpRmytlRTopEn0zPlFsgoZgQm0bp6anFUDndMvdQbMN kkQhgrXbw3RsWciOnSKJHPSR8NglaCP7ifMMhnnYBB2Ccx29b2qJSBSYQj99saWGrBAB Q+Ii3Ma/4KkF3asMlFdJROHNU5NjIiBWxBD9rqAMh1hx1CId+Scapv0bOWJQVtwW9C6A SIhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=pZziygPhjGhkMxsngfQBS+7si9TJ9jL3ZOgNpCiIOYY=; b=2Xd5ozDwjiQ37BvV97sTOkfQzRQteanXAPU02vezSEI7OtKlKfhOldi98/rFRFpbFG ocyfgcBUNTK8vph+xJ3Sj4z87kw/eXMhJ2Hm0TrcIPP90AEA1b8yv5/kmGksLrhIvujS hEKp6GROIDU6Rsg4zHtr5UoU/9rqvRIjFxgvgj0nHz+7O3NluXj2QUQvKH4yHT5MJkdw lfBpQ8baUj145RIdELCm/vndT1cMjf4aKsEjomnPrD+7i56pxaHNStDtnvTeASi4F7kg /WJsB+r2iZQ5DCNGm5apbJyPbu41czdkXTuNfjDZfIKAcZSUpyrNovnRAPI9BUy3bOjh gRoQ== X-Gm-Message-State: ACrzQf09lYxZORVJgcZfXza6og/o+ctv7vm02cFZbv6Zc8/vb90PJ1aA pKD1osW7PbXInqXbpYssAHJxGi2N9y5OkGAT5A== X-Received: by 2002:a05:600c:244:b0:3c6:bc2f:421b with SMTP id 4-20020a05600c024400b003c6bc2f421bmr1544227wmj.32.1666772171230; Wed, 26 Oct 2022 01:16:11 -0700 (PDT) Received: from platypus.lan ([2001:861:5e4c:3bb0:6424:328a:1734:3249]) by smtp.googlemail.com with ESMTPSA id q16-20020a05600c46d000b003c6f426467fsm1134310wmo.40.2022.10.26.01.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 01:16:10 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH Rust front-end v3 43/46] gccrs: Add lang.opt Date: Wed, 26 Oct 2022 10:18:08 +0200 Message-Id: <20221026081811.602573-44-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221026081811.602573-1-arthur.cohen@embecosm.com> References: <20221026081811.602573-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org 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?1747739531782745358?= X-GMAIL-MSGID: =?utf-8?q?1747739531782745358?= From: Philip Herron We have some rust specific langugage options note -fwrapv is enabled by default in the code. We are trying to respect options such as -Wunused-result which we get by porting over c++ no-discard for rust's must-use attribute, so we have enabled these by default directly here. --- gcc/rust/lang.opt | 118 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 gcc/rust/lang.opt diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt new file mode 100644 index 00000000000..1130999d277 --- /dev/null +++ b/gcc/rust/lang.opt @@ -0,0 +1,118 @@ +; Options for the Rust front end. +; Copyright (C) 2003-2022 Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; GCC is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License as published by the Free +; Software Foundation; either version 3, or (at your option) any later +; version. +; +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY +; WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +; for more details. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING3. If not see +; . + +; See the GCC internals manual for a description of this file's format. + +; Please try to keep this file in ASCII collating order. + +; Describes command-line options used by this frontend + +Language +Rust + +I +Rust Joined Separate +; Documented in c.opt + +L +Rust Joined Separate +; Not documented + +Wall +Rust +; Documented in c.opt + +Wunused-variable +Rust Var(warn_unused_variable) Warning +; documented in common.opt + +Wunused-const-variable +Rust Warning Alias(Wunused-const-variable=, 2, 0) +Warn when a const variable is unused. + +Wunused-const-variable= +Rust Joined RejectNegative UInteger Var(warn_unused_const_variable) Warning LangEnabledBy(Rust,Wunused-variable, 1, 0) IntegerRange(0, 2) +Warn when a const variable is unused. + +Wunused-result +Rust Var(warn_unused_result) Warning +Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value. + +frust-crate= +Rust Joined RejectNegative +-frust-crate= Set the crate name for the compilation + +frust-debug +Rust Var(flag_rust_debug) +Dump various Rust front end internals. + +frust-dump- +Rust Joined RejectNegative +-frust-dump- Dump Rust frontend internal information. + +frust-max-recursion-depth= +Rust RejectNegative Type(int) Var(rust_max_recursion_depth) Init(64) +-frust-max-recursion-depth=integer + +frust-mangling= +Rust Joined RejectNegative Enum(frust_mangling) Var(flag_rust_mangling) +-frust-mangling=[legacy|v0] Choose which version to use for name mangling + +Enum +Name(frust_mangling) Type(int) UnknownError(unknown rust mangling option %qs) + +EnumValue +Enum(frust_mangling) String(legacy) Value(0) + +EnumValue +Enum(frust_mangling) String(v0) Value(1) + +frust-cfg= +Rust Joined RejectNegative +-frust-cfg= Set a config expansion option + +frust-edition= +Rust Joined RejectNegative Enum(frust_edition) Var(flag_rust_edition) +-frust-edition=[2015|2018|2021] Choose which edition to use when compiling rust code + +Enum +Name(frust_edition) Type(int) UnknownError(unknown rust edition %qs) + +EnumValue +Enum(frust_edition) String(2015) Value(0) + +EnumValue +Enum(frust_edition) String(2018) Value(1) + +EnumValue +Enum(frust_edition) String(2021) Value(2) + +frust-embed-metadata +Rust Var(flag_rust_embed_metadata) +Flag to enable embeding metadata directly into object files + +frust-metadata-output= +Rust Joined RejectNegative +-frust-metadata-output= Path to output crate metadata + +o +Rust Joined Separate +; Documented in common.opt + +; This comment is to ensure we retain the blank line above.