Commit cce68562 by Robert Dewar Committed by Arnaud Charlet

clean.adb, [...]: Fix bad table increment values (much too small)

2006-10-31  Robert Dewar  <dewar@adacore.com>

	* clean.adb, gnatname.adb, gnatsym.adb, prep.adb, prep.ads,
	prepcomp.adb, prj.ads, prj-strt.adb, sem_maps.ads,
	vms_conv.adb: Fix bad table increment values (much too small)

	* table.adb (Realloc): Make sure we get at least some new elements
	Defends against silly small values for table increment

From-SVN: r118249
parent c064e066
...@@ -120,7 +120,7 @@ package body Clean is ...@@ -120,7 +120,7 @@ package body Clean is
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Clean.Processed_Projects"); Table_Name => "Clean.Processed_Projects");
-- Table to keep track of what project files have been processed, when -- Table to keep track of what project files have been processed, when
-- switch -r is specified. -- switch -r is specified.
...@@ -130,7 +130,7 @@ package body Clean is ...@@ -130,7 +130,7 @@ package body Clean is
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Clean.Processed_Projects"); Table_Name => "Clean.Processed_Projects");
-- Table to store all the source files of a library unit: spec, body and -- Table to store all the source files of a library unit: spec, body and
-- subunits, to detect .dg files and delete them. -- subunits, to detect .dg files and delete them.
......
...@@ -66,7 +66,7 @@ procedure Gnatname is ...@@ -66,7 +66,7 @@ procedure Gnatname is
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Gnatname.Excluded_Patterns"); Table_Name => "Gnatname.Excluded_Patterns");
-- Table to accumulate the negative patterns -- Table to accumulate the negative patterns
...@@ -75,7 +75,7 @@ procedure Gnatname is ...@@ -75,7 +75,7 @@ procedure Gnatname is
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Gnatname.Foreign_Patterns"); Table_Name => "Gnatname.Foreign_Patterns");
-- Table to accumulate the foreign patterns -- Table to accumulate the foreign patterns
...@@ -84,7 +84,7 @@ procedure Gnatname is ...@@ -84,7 +84,7 @@ procedure Gnatname is
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Gnatname.Patterns"); Table_Name => "Gnatname.Patterns");
-- Table to accumulate the name patterns -- Table to accumulate the name patterns
...@@ -93,7 +93,7 @@ procedure Gnatname is ...@@ -93,7 +93,7 @@ procedure Gnatname is
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Gnatname.Source_Directories"); Table_Name => "Gnatname.Source_Directories");
-- Table to accumulate the source directories specified directly with -d -- Table to accumulate the source directories specified directly with -d
-- or indirectly with -D. -- or indirectly with -D.
...@@ -102,8 +102,8 @@ procedure Gnatname is ...@@ -102,8 +102,8 @@ procedure Gnatname is
(Table_Component_Type => String_Access, (Table_Component_Type => String_Access,
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 2, Table_Initial => 10,
Table_Increment => 50, Table_Increment => 100,
Table_Name => "Gnatname.Preprocessor_Switches"); Table_Name => "Gnatname.Preprocessor_Switches");
-- Table to store the preprocessor switches to be used in the call -- Table to store the preprocessor switches to be used in the call
-- to the compiler. -- to the compiler.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2003-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2003-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -85,7 +85,7 @@ procedure Gnatsym is ...@@ -85,7 +85,7 @@ procedure Gnatsym is
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Gnatsymb.Object_Files"); Table_Name => "Gnatsymb.Object_Files");
-- A table to store the object file names -- A table to store the object file names
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2002, Free Software Foundation, Inc. -- -- Copyright (C) 2002-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -71,7 +71,7 @@ package Prep is ...@@ -71,7 +71,7 @@ package Prep is
Table_Index_Type => Symbol_Id, Table_Index_Type => Symbol_Id,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 10, Table_Initial => 10,
Table_Increment => 10); Table_Increment => 100);
-- The table of all symbols -- The table of all symbols
Mapping : Symbol_Table.Instance; Mapping : Symbol_Table.Instance;
......
...@@ -105,7 +105,7 @@ package body Prepcomp is ...@@ -105,7 +105,7 @@ package body Prepcomp is
Table_Index_Type => Int, Table_Index_Type => Int,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 5, Table_Initial => 5,
Table_Increment => 5, Table_Increment => 100,
Table_Name => "Prepcomp.Preproc_Data_Table"); Table_Name => "Prepcomp.Preproc_Data_Table");
-- Table to store the specific preprocessing data -- Table to store the specific preprocessing data
...@@ -117,8 +117,8 @@ package body Prepcomp is ...@@ -117,8 +117,8 @@ package body Prepcomp is
(Table_Component_Type => Source_File_Index, (Table_Component_Type => Source_File_Index,
Table_Index_Type => Int, Table_Index_Type => Int,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 5, Table_Initial => 10,
Table_Increment => 5, Table_Increment => 100,
Table_Name => "Prepcomp.Dependencies"); Table_Name => "Prepcomp.Dependencies");
-- Table to store the dependencies on preprocessing files -- Table to store the dependencies on preprocessing files
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -45,7 +45,7 @@ package body Prj.Strt is ...@@ -45,7 +45,7 @@ package body Prj.Strt is
-- been used (to avoid duplicate case labels). -- been used (to avoid duplicate case labels).
Choices_Initial : constant := 10; Choices_Initial : constant := 10;
Choices_Increment : constant := 50; Choices_Increment : constant := 100;
Choice_Node_Low_Bound : constant := 0; Choice_Node_Low_Bound : constant := 0;
Choice_Node_High_Bound : constant := 099_999_999; Choice_Node_High_Bound : constant := 099_999_999;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2001-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -316,7 +316,7 @@ package Prj is ...@@ -316,7 +316,7 @@ package Prj is
type String_Element is record type String_Element is record
Value : Name_Id := No_Name; Value : Name_Id := No_Name;
Index : Int := 0; Index : Int := 0;
Display_Value : Name_Id := No_Name; Display_Value : Name_Id := No_Name;
Location : Source_Ptr := No_Location; Location : Source_Ptr := No_Location;
Flag : Boolean := False; Flag : Boolean := False;
Next : String_List_Id := Nil_String; Next : String_List_Id := Nil_String;
...@@ -840,13 +840,13 @@ package Prj is ...@@ -840,13 +840,13 @@ package Prj is
(Specification, Body_Part); (Specification, Body_Part);
type File_Name_Data is record type File_Name_Data is record
Name : Name_Id := No_Name; Name : Name_Id := No_Name;
Index : Int := 0; Index : Int := 0;
Display_Name : Name_Id := No_Name; Display_Name : Name_Id := No_Name;
Path : Name_Id := No_Name; Path : Name_Id := No_Name;
Display_Path : Name_Id := No_Name; Display_Path : Name_Id := No_Name;
Project : Project_Id := No_Project; Project : Project_Id := No_Project;
Needs_Pragma : Boolean := False; Needs_Pragma : Boolean := False;
end record; end record;
-- File and Path name of a spec or body -- File and Path name of a spec or body
...@@ -1057,7 +1057,7 @@ private ...@@ -1057,7 +1057,7 @@ private
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 50, Table_Initial => 50,
Table_Increment => 50); Table_Increment => 100);
-- Table storing all the temp path file names. -- Table storing all the temp path file names.
-- Used by Delete_All_Path_Files. -- Used by Delete_All_Path_Files.
...@@ -1066,7 +1066,7 @@ private ...@@ -1066,7 +1066,7 @@ private
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 50, Table_Initial => 50,
Table_Increment => 50); Table_Increment => 100);
-- A table to store the source dirs before creating the source path file -- A table to store the source dirs before creating the source path file
package Object_Path_Table is new GNAT.Dynamic_Tables package Object_Path_Table is new GNAT.Dynamic_Tables
...@@ -1074,7 +1074,7 @@ private ...@@ -1074,7 +1074,7 @@ private
Table_Index_Type => Natural, Table_Index_Type => Natural,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 50, Table_Initial => 50,
Table_Increment => 50); Table_Increment => 100);
-- A table to store the object dirs, before creating the object path file -- A table to store the object dirs, before creating the object path file
type Private_Project_Tree_Data is record type Private_Project_Tree_Data is record
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1996-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1996-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -140,7 +140,7 @@ private ...@@ -140,7 +140,7 @@ private
Table_Index_Type => Map, Table_Index_Type => Map,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 100, Table_Initial => 100,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Maps_Table"); Table_Name => "Maps_Table");
-- All headers for hash tables are allocated in one global table. Each -- All headers for hash tables are allocated in one global table. Each
...@@ -151,7 +151,7 @@ private ...@@ -151,7 +151,7 @@ private
Table_Index_Type => Header_Index, Table_Index_Type => Header_Index,
Table_Low_Bound => 0, Table_Low_Bound => 0,
Table_Initial => 1000, Table_Initial => 1000,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Headers_Table"); Table_Name => "Headers_Table");
-- All associations are allocated in one global table. Each map stores -- All associations are allocated in one global table. Each map stores
...@@ -162,7 +162,7 @@ private ...@@ -162,7 +162,7 @@ private
Table_Index_Type => Assoc_Index, Table_Index_Type => Assoc_Index,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 1000, Table_Initial => 1000,
Table_Increment => 10, Table_Increment => 100,
Table_Name => "Associations_Table"); Table_Name => "Associations_Table");
end Sem_Maps; end Sem_Maps;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -163,7 +163,7 @@ package body Table is ...@@ -163,7 +163,7 @@ package body Table is
---------------- ----------------
procedure Reallocate is procedure Reallocate is
New_Size : Memory.size_t; New_Size : Memory.size_t;
begin begin
if Max < Last_Val then if Max < Last_Val then
...@@ -174,10 +174,15 @@ package body Table is ...@@ -174,10 +174,15 @@ package body Table is
Length := Int'Max (Length, Table_Initial); Length := Int'Max (Length, Table_Initial);
-- Now increment table length until it is sufficiently large -- Now increment table length until it is sufficiently large. Use
-- the increment value or 10, which ever is larger (the reason
-- for the use of 10 here is to ensure that the table does really
-- increase in size (which would not be the case for a table of
-- length 10 increased by 3% for instance).
while Max < Last_Val loop while Max < Last_Val loop
Length := Length * (100 + Table_Increment) / 100; Length := Int'Max (Length * (100 + Table_Increment) / 100,
Length + 10);
Max := Min + Length - 1; Max := Min + Length - 1;
end loop; end loop;
......
...@@ -78,7 +78,7 @@ package body VMS_Conv is ...@@ -78,7 +78,7 @@ package body VMS_Conv is
Table_Index_Type => Integer, Table_Index_Type => Integer,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 4096, Table_Initial => 4096,
Table_Increment => 2, Table_Increment => 100,
Table_Name => "Buffer"); Table_Name => "Buffer");
function Init_Object_Dirs return Argument_List; function Init_Object_Dirs return Argument_List;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment