diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-07-14 10:33:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 10:33:39 +0000 |
commit | ab9f7f287ef0a775ac6a504d743e20c2f5488f6f (patch) | |
tree | 09afaa39e16c27749014d1e5f9b547503408638c /gcc/rust | |
parent | 26114120fd6e1feb1b3cbbadfa569981df372a9f (diff) | |
parent | ee051b3c4443cabfb571ddb406d5a15d1f45c5d0 (diff) | |
download | gcc-ab9f7f287ef0a775ac6a504d743e20c2f5488f6f.zip gcc-ab9f7f287ef0a775ac6a504d743e20c2f5488f6f.tar.gz gcc-ab9f7f287ef0a775ac6a504d743e20c2f5488f6f.tar.bz2 |
Merge #1379
1379: backend: explain why cdecl is treated differently when setting up the ABIs r=philberty a=liushuyu
- backend: explain why `cdecl` is treated differently when setting up the ABIs
Co-authored-by: liushuyu <liushuyu011@gmail.com>
Diffstat (limited to 'gcc/rust')
-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)); |