From: Pierre-Emmanuel Patry <[email protected]>
Add deny, warn and forbid attribute values.
gcc/rust/ChangeLog:
* checks/errors/rust-builtin-attribute-checker.cc (std::function<void):
Use the new attribute value variables instead of raw values.
* util/rust-attribute-values.h: Add deny, warn and forbid values.
Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
gcc/rust/checks/errors/rust-builtin-attribute-checker.cc | 6 +++---
gcc/rust/util/rust-attribute-values.h | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gcc/rust/checks/errors/rust-builtin-attribute-checker.cc
b/gcc/rust/checks/errors/rust-builtin-attribute-checker.cc
index f6a2e2c836d..9078a10164a 100644
--- a/gcc/rust/checks/errors/rust-builtin-attribute-checker.cc
+++ b/gcc/rust/checks/errors/rust-builtin-attribute-checker.cc
@@ -369,9 +369,9 @@ const std::unordered_map<std::string, std::function<void
(AST::Attribute &)>>
{Attrs::EXPORT_NAME, handlers::export_name},
{Attrs::NO_MANGLE, handlers::no_mangle},
{Attrs::ALLOW, handlers::lint},
- {"deny", handlers::lint},
- {"warn", handlers::lint},
- {"forbid", handlers::lint},
+ {Attrs::DENY, handlers::lint},
+ {Attrs::WARN, handlers::lint},
+ {Attrs::FORBID, handlers::lint},
{Attrs::LINK_NAME, handlers::link_name},
{Attrs::PROC_MACRO_DERIVE, handlers::proc_macro_derive},
{Attrs::PROC_MACRO, handlers::proc_macro},
diff --git a/gcc/rust/util/rust-attribute-values.h
b/gcc/rust/util/rust-attribute-values.h
index a9e07bf015e..332d65e80dd 100644
--- a/gcc/rust/util/rust-attribute-values.h
+++ b/gcc/rust/util/rust-attribute-values.h
@@ -32,6 +32,9 @@ public:
static constexpr auto &DERIVE_ATTR = "derive";
static constexpr auto &DEPRECATED = "deprecated";
static constexpr auto &ALLOW = "allow";
+ static constexpr auto &DENY = "deny";
+ static constexpr auto &WARN = "warn";
+ static constexpr auto &FORBID = "forbid";
static constexpr auto &ALLOW_INTERNAL_UNSTABLE = "allow_internal_unstable";
static constexpr auto &DOC = "doc";
static constexpr auto &MUST_USE = "must_use";
--
2.50.1