diff options
author | Bob Duff <duff@adacore.com> | 2017-04-25 13:37:18 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-04-25 15:37:18 +0200 |
commit | 0f96fd143cd249110dcdeabea7fd8972b91b86c6 (patch) | |
tree | fa63d732e414c06875cdb37cbfc725c72890f52b /gcc/ada/sinput.adb | |
parent | 7d5dbb22ec8e0c1f104539d3fdf2afc5174a5b45 (diff) | |
download | gcc-0f96fd143cd249110dcdeabea7fd8972b91b86c6.zip gcc-0f96fd143cd249110dcdeabea7fd8972b91b86c6.tar.gz gcc-0f96fd143cd249110dcdeabea7fd8972b91b86c6.tar.bz2 |
err_vars.ads, [...]: Eliminate the vestigial Internal_Source_File and the Internal_Source buffer.
2017-04-25 Bob Duff <duff@adacore.com>
* err_vars.ads, fmap.adb, fmap.ads, comperr.adb, fname-sf.adb,
types.adb, types.ads, types.h, sinput-l.adb, targparm.adb,
errout.adb, sinput.adb, sinput.ads, cstand.adb, scn.adb,
scn.ads, gnatls.adb: Eliminate the vestigial Internal_Source_File and
the Internal_Source buffer. This removes the incorrect call to "="
the customer noticed.
Wrap remaining calls to "=" in Null_Source_Buffer_Ptr. We
eventually need to eliminate them altogether. Or else get rid
of zero-origin addressing.
From-SVN: r247234
Diffstat (limited to 'gcc/ada/sinput.adb')
-rw-r--r-- | gcc/ada/sinput.adb | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb index 4d0cbdd..b3cfa49 100644 --- a/gcc/ada/sinput.adb +++ b/gcc/ada/sinput.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -876,19 +876,24 @@ package body Sinput is declare S : Source_File_Record renames Source_File.Table (J); + type Source_Buffer_Ptr_Var is access all Big_Source_Buffer; + procedure Free_Ptr is new Unchecked_Deallocation - (Big_Source_Buffer, Source_Buffer_Ptr); + (Big_Source_Buffer, Source_Buffer_Ptr_Var); + -- This works only because we're calling malloc, which keeps + -- track of the size on its own, ignoring the size of + -- Big_Source_Buffer, which is the wrong size. pragma Warnings (Off); -- This unchecked conversion is aliasing safe, since it is not -- used to create improperly aliased pointer values. - function To_Source_Buffer_Ptr is new - Unchecked_Conversion (Address, Source_Buffer_Ptr); + function To_Source_Buffer_Ptr_Var is new + Unchecked_Conversion (Address, Source_Buffer_Ptr_Var); pragma Warnings (On); - Tmp1 : Source_Buffer_Ptr; + Tmp1 : Source_Buffer_Ptr_Var; begin if S.Instance /= No_Instance_Id then @@ -903,7 +908,7 @@ package body Sinput is -- from the zero origin pointer stored in the source table. Tmp1 := - To_Source_Buffer_Ptr + To_Source_Buffer_Ptr_Var (S.Source_Text (S.Source_First)'Address); Free_Ptr (Tmp1); @@ -1254,29 +1259,17 @@ package body Sinput is function Source_First (S : SFI) return Source_Ptr is begin - if S = Internal_Source_File then - return Internal_Source'First; - else - return Source_File.Table (S).Source_First; - end if; + return Source_File.Table (S).Source_First; end Source_First; function Source_Last (S : SFI) return Source_Ptr is begin - if S = Internal_Source_File then - return Internal_Source'Last; - else - return Source_File.Table (S).Source_Last; - end if; + return Source_File.Table (S).Source_Last; end Source_Last; function Source_Text (S : SFI) return Source_Buffer_Ptr is begin - if S = Internal_Source_File then - return Internal_Source_Ptr; - else - return Source_File.Table (S).Source_Text; - end if; + return Source_File.Table (S).Source_Text; end Source_Text; function Template (S : SFI) return SFI is |