diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2011-12-11 10:54:52 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2011-12-11 10:54:52 +0000 |
commit | 4f96985d582c4b3cd0228a760e8aedc98488adba (patch) | |
tree | 866e2a85362fea662e43d4ddee9a4b625ebe68ff /gcc/ada/gcc-interface | |
parent | 50751f49cced190a50c41cfee670267a0ce5e3ba (diff) | |
download | gcc-4f96985d582c4b3cd0228a760e8aedc98488adba.zip gcc-4f96985d582c4b3cd0228a760e8aedc98488adba.tar.gz gcc-4f96985d582c4b3cd0228a760e8aedc98488adba.tar.bz2 |
decl.c (gnat_to_gnu_param): Set the restrict qualifier on references built for parameters which aren't...
* gcc-interface/decl.c (gnat_to_gnu_param): Set the restrict qualifier
on references built for parameters which aren't specifically by-ref.
From-SVN: r182202
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index aecbd76..c3774f2 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5518,7 +5518,15 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, || (!foreign && default_pass_by_ref (gnu_param_type))))) { + /* We take advantage of 6.2(12) by considering that references built for + parameters whose type isn't by-ref and for which the mechanism hasn't + been forced to by-ref are restrict-qualified in the C sense. */ + bool restrict_p + = !TREE_ADDRESSABLE (gnu_param_type) && mech != By_Reference; gnu_param_type = build_reference_type (gnu_param_type); + if (restrict_p) + gnu_param_type + = build_qualified_type (gnu_param_type, TYPE_QUAL_RESTRICT); by_ref = true; /* In some ABIs, e.g. SPARC 32-bit, fat pointer types are themselves |