From: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::handle_crate_name): Use the new
constexpr instead of a raw string value.
* util/rust-attribute-values.h: Add crate_name and crate_type values.
Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/f69b5b53a4b226e48c3a8b8739ea17230745b028
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4425
gcc/rust/rust-session-manager.cc | 2 +-
gcc/rust/util/rust-attribute-values.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index cf3237ccd..a74b99754 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -476,7 +476,7 @@ Session::handle_crate_name (const char *filename,
for (const auto &attr : parsed_crate.inner_attrs)
{
- if (attr.get_path () != "crate_name")
+ if (attr.get_path () != Values::Attributes::CRATE_NAME)
continue;
auto msg_str = Analysis::Attributes::extract_string_literal (attr);
diff --git a/gcc/rust/util/rust-attribute-values.h
b/gcc/rust/util/rust-attribute-values.h
index 34e938025..f4146b880 100644
--- a/gcc/rust/util/rust-attribute-values.h
+++ b/gcc/rust/util/rust-attribute-values.h
@@ -50,6 +50,8 @@ public:
static constexpr auto &PROC_MACRO = "proc_macro";
static constexpr auto &PROC_MACRO_DERIVE = "proc_macro_derive";
static constexpr auto &PROC_MACRO_ATTRIBUTE = "proc_macro_attribute";
+ static constexpr auto &CRATE_NAME = "crate_name";
+ static constexpr auto &CRATE_TYPE = "crate_type";
static constexpr auto &TARGET_FEATURE = "target_feature";
static constexpr auto &FEATURE = "feature";
--
2.53.0