aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/namet.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 17:54:39 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 17:54:39 +0200
commit211e7410b32e6cb4b45d414883c5d6d5f37faa31 (patch)
tree55dae71c0ef21060e28548eed6b71f8e8f1b0965 /gcc/ada/namet.adb
parentf66c70dc0392cfa06f6414a8b9fa65adb9051b58 (diff)
downloadgcc-211e7410b32e6cb4b45d414883c5d6d5f37faa31.zip
gcc-211e7410b32e6cb4b45d414883c5d6d5f37faa31.tar.gz
gcc-211e7410b32e6cb4b45d414883c5d6d5f37faa31.tar.bz2
[multiple changes]
2017-04-25 Arnaud Charlet <charlet@adacore.com> * exp_ch4.adb (Expand_N_Case_Expression): Emit error message when generating C code on complex case expressions. 2017-04-25 Arnaud Charlet <charlet@adacore.com> * sem_prag.adb (Analyze_Pragma): Generate a warning instead of silently ignoring pragma Ada_xxx in Latest_Ada_Only mode. * directio.ads, ioexcept.ads, sequenio.ads, text_io.ads: Use Ada_2012 instead of Ada_2005 to be compatible with the above change. * bindgen.adb: Silence new warning on pragma Ada_95. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Generate_Range_Check): Revert part of previous change. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Try_Container_Indexing): Handle properly a container indexing operation that appears as a an actual in a parameter association in a procedure call. 2017-04-25 Olivier Ramonat <ramonat@adacore.com> * prj-proc.adb, sem_util.adb, s-stposu.adb, sem_attr.adb, prj-conf.ads: Fix spelling mistakes. 2017-04-25 Bob Duff <duff@adacore.com> * types.ads, osint.adb, sinput-c.adb, sinput-d.adb, sinput-l.adb, * sinput-p.adb: Use regular fat pointers, with bounds checking, for source buffers. Fix misc obscure bugs. * sinput.ads, sinput.adb: Use regular fat pointers, with bounds checking, for source buffers. Modify representation clause for Source_File_Record as appropriate. Move Source_File_Index_Table from spec to body, because it is not used outside the body. Move Set_Source_File_Index_Table into the private part, because it is used only in the body and in children. Use trickery to modify the dope in the generic instantiation case. It's ugly, but not as ugly as the previous method. Fix documentation. Remove obsolete code. * fname-sf.adb, targparm.adb: Fix misc out-of-bounds indexing in source buffers. * fmap.adb: Avoid conversions from one string type to another. Remove a use of global name buffer. * osint.ads, sfn_scan.ads, sfn_scan.adb, sinput-c.ads: Comment fixes. From-SVN: r247252
Diffstat (limited to 'gcc/ada/namet.adb')
-rw-r--r--gcc/ada/namet.adb17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb
index 6b9f61d..aed8531 100644
--- a/gcc/ada/namet.adb
+++ b/gcc/ada/namet.adb
@@ -809,7 +809,7 @@ package body Namet is
end Get_Name_String;
function Get_Name_String (Id : Name_Id) return String is
- Buf : Bounded_String;
+ Buf : Bounded_String (Max_Length => Natural (Length_Of_Name (Id)));
begin
Append (Buf, Id);
return +Buf;
@@ -1020,7 +1020,7 @@ package body Namet is
end Is_Internal_Name;
function Is_Internal_Name (Id : Name_Id) return Boolean is
- Buf : Bounded_String;
+ Buf : Bounded_String (Max_Length => Natural (Length_Of_Name (Id)));
begin
if Id in Error_Name_Or_No_Name then
return False;
@@ -1132,6 +1132,13 @@ package body Namet is
return Name_Entries.Last;
end Name_Enter;
+ function Name_Enter (S : String) return Name_Id is
+ Buf : Bounded_String (Max_Length => S'Length);
+ begin
+ Append (Buf, S);
+ return Name_Enter (Buf);
+ end Name_Enter;
+
--------------------------
-- Name_Entries_Address --
--------------------------
@@ -1240,7 +1247,7 @@ package body Namet is
end Name_Find;
function Name_Find (S : String) return Name_Id is
- Buf : Bounded_String;
+ Buf : Bounded_String (Max_Length => S'Length);
begin
Append (Buf, S);
return Name_Find (Buf);
@@ -1743,7 +1750,7 @@ package body Namet is
else
declare
- Buf : Bounded_String;
+ Buf : Bounded_String (Max_Length => Natural (Length_Of_Name (Id)));
begin
Append (Buf, Id);
Write_Str (Buf.Chars (1 .. Buf.Length));
@@ -1758,7 +1765,7 @@ package body Namet is
----------------
procedure Write_Name (Id : Name_Id) is
- Buf : Bounded_String;
+ Buf : Bounded_String (Max_Length => Natural (Length_Of_Name (Id)));
begin
if Id >= First_Name_Id then
Append (Buf, Id);