[Ada] Fix initialization problems on global variables in frontend
Arnaud Charlet
charlet@adacore.com
Tue Apr 23 17:49:00 GMT 2013
These initialization errors were discovered by running the compiler compiled
with -gnatVa and pragma Initialize_Scalars.
Tested on x86_64-pc-linux-gnu, committed on trunk
2013-04-23 Yannick Moy <moy@adacore.com>
* err_vars.ads (Error_Msg_Qual_Level): Set variable to zero
at declaration.
* opt.ads (Multiple_Unit_Index): Set variable to zero at declaration.
* sem_util.adb (NCT_Table_Entries): Set variable to zero at declaration.
* set_targ.ads (Num_FPT_Modes): Set variable to zero at declaration.
* stylesw.adb (Save_Style_Check_Options): Protect testing the
value of Style_Check_Comments_Spacing by a previous test that
Style_Check_Comments is True.
-------------- next part --------------
Index: err_vars.ads
===================================================================
--- err_vars.ads (revision 198175)
+++ err_vars.ads (working copy)
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -54,7 +54,7 @@
-- variables are not reset by calls to the error message routines, so the
-- caller is responsible for resetting the default behavior after use.
- Error_Msg_Qual_Level : Int;
+ Error_Msg_Qual_Level : Int := 0;
-- Number of levels of qualification required for type name (see the
-- description of the } insertion character. Note that this value does
-- note get reset by any Error_Msg call, so the caller is responsible
Index: sem_util.adb
===================================================================
--- sem_util.adb (revision 198188)
+++ sem_util.adb (working copy)
@@ -83,7 +83,7 @@
NCT_Hash_Tables_Used : Boolean := False;
-- Set to True if hash tables are in use
- NCT_Table_Entries : Nat;
+ NCT_Table_Entries : Nat := 0;
-- Count entries in table to see if threshold is reached
NCT_Hash_Table_Setup : Boolean := False;
Index: stylesw.adb
===================================================================
--- stylesw.adb (revision 198175)
+++ stylesw.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -161,10 +161,12 @@
Add ('b', Style_Check_Blanks_At_End);
Add ('B', Style_Check_Boolean_And_Or);
- if Style_Check_Comments_Spacing = 2 then
- Add ('c', Style_Check_Comments);
- elsif Style_Check_Comments_Spacing = 1 then
- Add ('C', Style_Check_Comments);
+ if Style_Check_Comments then
+ if Style_Check_Comments_Spacing = 2 then
+ Add ('c', Style_Check_Comments);
+ elsif Style_Check_Comments_Spacing = 1 then
+ Add ('C', Style_Check_Comments);
+ end if;
end if;
Add ('d', Style_Check_DOS_Line_Terminator);
Index: set_targ.ads
===================================================================
--- set_targ.ads (revision 198175)
+++ set_targ.ads (working copy)
@@ -98,7 +98,7 @@
end record;
FPT_Mode_Table : array (1 .. 1000) of FPT_Mode_Entry;
- Num_FPT_Modes : Natural;
+ Num_FPT_Modes : Natural := 0;
-- Table containing the supported modes and number of entries
-----------------
Index: opt.ads
===================================================================
--- opt.ads (revision 198175)
+++ opt.ads (working copy)
@@ -968,7 +968,7 @@
-- GNATMAKE
-- Set to True if minimal recompilation mode requested
- Multiple_Unit_Index : Int;
+ Multiple_Unit_Index : Int := 0;
-- GNAT
-- This is set non-zero if the current unit is being compiled in multiple
-- unit per file mode, meaning that the current unit is selected from the
More information about the Gcc-patches
mailing list