]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
attributes: Handle external tool annotations like rustfmt::
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 9 Apr 2025 13:17:38 +0000 (15:17 +0200)
committerCohenArthur <arthur.cohen@embecosm.com>
Mon, 14 Apr 2025 12:35:00 +0000 (12:35 +0000)
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 d5b6dec4a71f2aac0a32d74ad82d944ea176b37a..d8013c1085159d9be064d5b92768e154333321bf 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 1d69b7af239b48d6174796cf98118025b82d0962..6e0aa48b26f5da1fa08dd53b93eff63d224309bb 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 0442ff1d52584f3212dff0cb420260a0d4138055..2c1bd195b5285f3dec217a8189bd4c1efbf7e236 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 e7e50835f58c6d4b50192a5445fb4fc7b8cf9043..16e4847da99e0d1ef8a3ad7405e59db11dee88d2 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?
 };