diff options
author | liushuyu <liushuyu011@gmail.com> | 2022-07-13 02:20:20 -0600 |
---|---|---|
committer | liushuyu <liushuyu011@gmail.com> | 2022-07-13 02:20:20 -0600 |
commit | ee051b3c4443cabfb571ddb406d5a15d1f45c5d0 (patch) | |
tree | 09afaa39e16c27749014d1e5f9b547503408638c | |
parent | 26114120fd6e1feb1b3cbbadfa569981df372a9f (diff) | |
download | gcc-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.cc | 6 |
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)); |