aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/rust/backend/rust-compile-base.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index 5bf64cc..28f3941 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -304,6 +304,12 @@ HIRCompileBase::setup_abi_options (tree fndecl, ABI abi)
case Rust::ABI::INTRINSIC:
case Rust::ABI::C:
case Rust::ABI::CDECL:
+ // `decl_attributes` function (not the macro) has the side-effect of
+ // actually switching the codegen backend to use the ABI we annotated.
+ // However, since `cdecl` is the default ABI GCC will be using, explicitly
+ // specifying that ABI will cause GCC to emit a warning saying the
+ // attribute is useless (which is confusing to the user as the attribute
+ // is added by us).
DECL_ATTRIBUTES (fndecl)
= tree_cons (get_identifier ("cdecl"), NULL, DECL_ATTRIBUTES (fndecl));