aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliushuyu <liushuyu011@gmail.com>2022-07-13 02:20:20 -0600
committerliushuyu <liushuyu011@gmail.com>2022-07-13 02:20:20 -0600
commitee051b3c4443cabfb571ddb406d5a15d1f45c5d0 (patch)
tree09afaa39e16c27749014d1e5f9b547503408638c
parent26114120fd6e1feb1b3cbbadfa569981df372a9f (diff)
downloadgcc-ee051b3c4443cabfb571ddb406d5a15d1f45c5d0.zip
gcc-ee051b3c4443cabfb571ddb406d5a15d1f45c5d0.tar.gz
gcc-ee051b3c4443cabfb571ddb406d5a15d1f45c5d0.tar.bz2
backend: explain why cdecl is treated differently ...
... when setting up the ABIs Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
-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));