aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch6.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-12-08 10:51:29 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-01-03 10:29:53 +0100
commitbfe1ab222a8095b31c29d8f3530268f048fea00f (patch)
tree0c9b2fb1534a52fb29ce8a0e67646f4e916d7788 /gcc/ada/exp_ch6.adb
parent742084ada1e0974f5c7491fda65702e45bd07848 (diff)
downloadgcc-bfe1ab222a8095b31c29d8f3530268f048fea00f.zip
gcc-bfe1ab222a8095b31c29d8f3530268f048fea00f.tar.gz
gcc-bfe1ab222a8095b31c29d8f3530268f048fea00f.tar.bz2
ada: Fix calling convention of foreign functions returning limited type
Such functions use neither Ada 2005's build-in-place mechanism nor Ada 95's return-by-reference mechanism, but instead the common calling convention of functions returning a nonlimited by-reference type. gcc/ada/ * exp_ch6.adb (Is_Build_In_Place_Function): Adjust comment. * sem_util.adb (Compute_Returns_By_Ref): Do not set Returns_By_Ref on functions with foreign convention.
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r--gcc/ada/exp_ch6.adb8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 975a966..d90ee41 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -7759,10 +7759,10 @@ package body Exp_Ch6 is
return False;
end if;
- -- If the function is imported from a foreign language, we don't do
- -- build-in-place, whereas Import (Ada) functions can do it. Note also
- -- that it is OK for a build-in-place function to return a type with a
- -- foreign convention because the machinery ensures there is no copying.
+ -- We never use build-in-place if the convention is other than Ada,
+ -- but note that it is OK for a build-in-place function to return a
+ -- type with a foreign convention because the machinery ensures there
+ -- is no copying.
return (Kind in E_Function | E_Generic_Function
or else