aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.cc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-01-29 12:47:51 +0000
committerGitHub <noreply@github.com>2022-01-29 12:47:51 +0000
commitbc7f518ac6f5c05f1c6edd7a1601f32753bab47d (patch)
tree52b86d1861ae8d09d77169b0a53b8ccbc245b48f /gcc/rust/rust-session-manager.cc
parent9346bddb100a3a047e22f980e64c36006fa029d5 (diff)
parentebfbdf962fb3e65e17ad8a0477558549e924dd22 (diff)
downloadgcc-bc7f518ac6f5c05f1c6edd7a1601f32753bab47d.zip
gcc-bc7f518ac6f5c05f1c6edd7a1601f32753bab47d.tar.gz
gcc-bc7f518ac6f5c05f1c6edd7a1601f32753bab47d.tar.bz2
Merge #899
899: Add -frust-cfg=value option for adding config options r=philberty a=philberty This adds the initial support for config expansion on custom config values it need support for parsing options such as feature=test with apropriate error handling withing Session::handle_cfg_option(const std::string&). This also applies the mark_for_strip checks only on AST::Functions and will need applied to the rest of the crate in #872. Addresses #889 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
-rw-r--r--gcc/rust/rust-session-manager.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 9650086..c930f55 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -353,9 +353,11 @@ Session::handle_option (
case OPT_I:
// TODO: add search path
break;
+
case OPT_L:
// TODO: add library link path or something
break;
+
case OPT_frust_crate_:
// set the crate name
if (arg != nullptr)
@@ -363,6 +365,7 @@ Session::handle_option (
else
ret = false;
break;
+
case OPT_frust_dump_:
// enable dump and return whether this was successful
if (arg != nullptr)
@@ -374,17 +377,31 @@ Session::handle_option (
ret = false;
}
break;
+
case OPT_frust_mangling_:
Compile::Mangler::set_mangling (flag_rust_mangling);
- // no option handling for -o
+ break;
+
+ case OPT_frust_cfg_:
+ ret = handle_cfg_option (std::string (arg));
+ break;
+
default:
- // return 1 to indicate option is valid
break;
}
return ret;
}
+bool
+Session::handle_cfg_option (const std::string &value)
+{
+ // rustc doesn't seem to error on any duplicate key
+ // TODO handle feature=bla and relevant error handling in parsing
+ options.target_data.insert_key (value);
+ return true;
+}
+
/* Enables a certain dump depending on the name passed in. Returns true if name
* is valid, false otherwise. */
bool