]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: attributes: Handle external tool annotations like rustfmt::
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 9 Apr 2025 13:17:38 +0000 (15:17 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 14 Apr 2025 16:23:56 +0000 (18:23 +0200)
gcc/rust/ChangeLog:

* util/rust-attribute-values.h: Add RUSTFMT value.
* util/rust-attributes.cc: Define the attribute.
* util/rust-attributes.h (enum CompilerPass): Add EXTERNAL variant.
* expand/rust-macro-builtins.cc: Fix formatting.

gcc/rust/expand/rust-macro-builtins.cc
gcc/rust/util/rust-attribute-values.h
gcc/rust/util/rust-attributes.cc
gcc/rust/util/rust-attributes.h

index a1388fb1dfb3066e4ce05e10fee0b7524d7af75f..8b406fff9e63f0fb09b537073a50992f69d153e1 100644 (file)
@@ -83,7 +83,6 @@ const BiMap<std::string, BuiltinMacro> MacroBuiltin::builtins = {{
   {"Ord", BuiltinMacro::Ord},
   {"PartialOrd", BuiltinMacro::PartialOrd},
   {"Hash", BuiltinMacro::Hash},
-
 }};
 
 AST::MacroTranscriberFunc
index 50ccb4ab6dc01d319bf41ea5ae4e2b019e73f8b8..47e6a175396cf2deeef4d47549157558e7428720 100644 (file)
@@ -83,6 +83,8 @@ public:
   static constexpr auto &FUNDAMENTAL = "fundamental";
 
   static constexpr auto &NON_EXHAUSTIVE = "non_exhaustive";
+
+  static constexpr auto &RUSTFMT = "rustfmt";
 };
 } // namespace Values
 } // namespace Rust
index 7ddb476bbe6f9c03819b9db5885ff2f8205a542b..c77e99c1ca5ad2149ea7fbe88d8045c648bee262 100644 (file)
@@ -94,7 +94,8 @@ static const BuiltinAttrDefinition __definitions[]
      {Attrs::RUSTC_ON_UNIMPLEMENTED, STATIC_ANALYSIS},
 
      {Attrs::FUNDAMENTAL, TYPE_CHECK},
-     {Attrs::NON_EXHAUSTIVE, TYPE_CHECK}};
+     {Attrs::NON_EXHAUSTIVE, TYPE_CHECK},
+     {Attrs::RUSTFMT, EXTERNAL}};
 
 BuiltinAttributeMappings *
 BuiltinAttributeMappings::get ()
index 7e7cd2c3c6335ccb07b6615f28708d01b2ebdb57..7c7a1fc3f6b16f57e94cc35c21f22e3a161115a3 100644 (file)
@@ -40,7 +40,10 @@ enum CompilerPass
   HIR_LOWERING,
   TYPE_CHECK,
   STATIC_ANALYSIS,
-  CODE_GENERATION
+  CODE_GENERATION,
+
+  // External Rust tooling attributes, like #[rustfmt::skip]
+  EXTERNAL,
 
   // Do we need to add something here for const fns?
 };