public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] long_flag: Add env variable, remove bootstrap guards
Date: Thu,  8 Dec 2022 08:00:03 +0000 (GMT)	[thread overview]
Message-ID: <20221208080003.2EDE33945E28@sourceware.org> (raw)

https://gcc.gnu.org/g:b2d445c2bbb15e6a1f1d0e5ac693fd671ecaa473

commit b2d445c2bbb15e6a1f1d0e5ac693fd671ecaa473
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Fri Dec 2 10:19:39 2022 +0100

    long_flag: Add env variable, remove bootstrap guards

Diff:
---
 gcc/rust/Make-lang.in            | 11 +++--------
 gcc/rust/rust-session-manager.cc | 10 +++++-----
 gcc/testsuite/lib/rust.exp       |  2 ++
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in
index 656c46dba7e..21d7d4eef71 100644
--- a/gcc/rust/Make-lang.in
+++ b/gcc/rust/Make-lang.in
@@ -49,13 +49,6 @@ GCCRS_D_OBJS = \
    rust/rustspec.o \
    $(END)
 
-RUST_CXXFLAGS = $(CXXFLAGS)
-
-# If the file exists, we're bootstrapping. Set a specific flag for the session manager.
-ifneq ($(wildcard ../stage_current),)
-SESSION_FLAGS = -DRUST_BOOTSTRAP_BUILD
-endif
-
 gccrs$(exeext): $(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
 	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
 	  $(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
@@ -336,7 +329,9 @@ RUST_INCLUDES = -I $(srcdir)/rust \
 CFLAGS-rust/rust-lang.o += $(RUST_INCLUDES)
 CFLAGS-rust/rust-lex.o += $(RUST_INCLUDES)
 CFLAGS-rust/rust-parse.o += $(RUST_INCLUDES)
-CFLAGS-rust/rust-session-manager.o += $(RUST_INCLUDES) $(SESSION_FLAGS)
+CFLAGS-rust/rust-session-manager.o += $(RUST_INCLUDES)
+
+RUST_CXXFLAGS = $(CXXFLAGS)
 
 # build all rust/lex files in rust folder, add cross-folder includes
 rust/%.o: rust/lex/%.cc
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 78dc3a01ccb..54660a85322 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -427,9 +427,8 @@ Session::handle_crate_name (const AST::Crate &parsed_crate)
 void
 Session::compile_crate (const char *filename)
 {
-#ifdef RUST_BOOTSTRAP_BUILD
-  // Do not emit the fatal error or require the flag for dev builds
-  if (!flag_rust_experimental)
+  if (!flag_rust_experimental
+      && !std::getenv ("GCCRS_INCOMPLETE_AND_EXPERIMENTAL_COMPILER_DO_NOT_USE"))
     rust_fatal_error (
       Location (), "%s",
       "gccrs is not yet able to compile Rust code "
@@ -443,11 +442,12 @@ Session::compile_crate (const char *filename)
       "If you understand this, and understand that the binaries produced might "
       "not behave accordingly, you may attempt to use gccrs in an experimental "
       "manner by passing the following flag:\n\n"
-      "`-frust-incomplete-and-experimental-compiler-do-not-use`\n\nFor "
+      "`-frust-incomplete-and-experimental-compiler-do-not-use`\n\nor by "
+      "defining the following environment variable (any value will "
+      "do)\n\nGCCRS_INCOMPLETE_AND_EXPERIMENTAL_COMPILER_DO_NOT_USE\n\nFor"
       "cargo-gccrs, this means passing\n\n"
       "GCCRS_EXTRA_FLAGS=\"-frust-incomplete-and-experimental-compiler-do-not-"
       "use\"\n\nas an environment variable.");
-#endif
 
   RAIIFile file_wrap (filename);
   if (!file_wrap.ok ())
diff --git a/gcc/testsuite/lib/rust.exp b/gcc/testsuite/lib/rust.exp
index 6993c976304..287905bd544 100644
--- a/gcc/testsuite/lib/rust.exp
+++ b/gcc/testsuite/lib/rust.exp
@@ -149,6 +149,8 @@ proc rust_init { args } {
 	lappend ALWAYS_RUSTFLAGS "additional_flags=$TOOL_OPTIONS"
     }
 
+	lappend ALWAYS_RUSTFLAGS "additional_flags=-frust-incomplete-and-experimental-compiler-do-not-use"	
+	
     verbose -log "ALWAYS_RUSTFLAGS set to $ALWAYS_RUSTFLAGS"
 
     set gcc_warning_prefix "warning:"

                 reply	other threads:[~2022-12-08  8:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221208080003.2EDE33945E28@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).