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]>
---
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/a37e1ea15ab4c72bf7f38868484e1fafa8347e15

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4505

 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 f6a2e2c83..9078a1016 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 a9e07bf01..332d65e80 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.53.0

Reply via email to