Patchwork [Ada] Save/restore value of pragma Normalize_Scalars

login
register
mail settings
Submitter Arnaud Charlet
Date Aug. 4, 2011, 11:57 a.m.
Message ID <20110804115748.GA22766@adacore.com>
Download mbox | patch
Permalink /patch/108418/
State New
Headers show

Comments

Arnaud Charlet - Aug. 4, 2011, 11:57 a.m.
This patch adds the missing support to the frontend to save and restore
consistently the settings of pragma Normalize_Scalars. Required to have
consistent setting of its value when the compilation of a unit causes
implicit analysis of runtime units. Before applying this patch the
compilation of the following small test caused an assertion
failure in the frontend.

with Ada.Text_IO;
package ImpDef is end;

pragma Normalize_Scalars;
with Impdef;
package CXH1001_0 is end;

Command: gcc -c cxh1001_0.ads

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-04  Javier Miranda  <miranda@adacore.com>

	* opt.ads
	(Normalize_Scalars_Config): Value of the configuration switch set by
	pragma Normalize_Scalars when it appears in the gnat.adc file.
	(Normalize_Scalars): New field for record Config_Switches_Type. Used
	to save and restore settings of this pragma.
	* opt.adb
	(Register_Opt_Config_Switches, Save_Opt_Config_Switches,
	Restore_Opt_Config_Switches): Add missing support for Normalize_Scalars.

Patch

Index: opt.adb
===================================================================
--- opt.adb	(revision 177274)
+++ opt.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
@@ -59,6 +59,7 @@ 
       Fast_Math_Config                      := Fast_Math;
       Init_Or_Norm_Scalars_Config           := Init_Or_Norm_Scalars;
       Initialize_Scalars_Config             := Initialize_Scalars;
+      Normalize_Scalars_Config              := Normalize_Scalars;
       Optimize_Alignment_Config             := Optimize_Alignment;
       Persistent_BSS_Mode_Config            := Persistent_BSS_Mode;
       Polling_Required_Config               := Polling_Required;
@@ -93,6 +94,7 @@ 
       Fast_Math                      := Save.Fast_Math;
       Init_Or_Norm_Scalars           := Save.Init_Or_Norm_Scalars;
       Initialize_Scalars             := Save.Initialize_Scalars;
+      Normalize_Scalars              := Save.Normalize_Scalars;
       Optimize_Alignment             := Save.Optimize_Alignment;
       Optimize_Alignment_Local       := Save.Optimize_Alignment_Local;
       Persistent_BSS_Mode            := Save.Persistent_BSS_Mode;
@@ -122,6 +124,7 @@ 
       Save.Fast_Math                      := Fast_Math;
       Save.Init_Or_Norm_Scalars           := Init_Or_Norm_Scalars;
       Save.Initialize_Scalars             := Initialize_Scalars;
+      Save.Normalize_Scalars              := Normalize_Scalars;
       Save.Optimize_Alignment             := Optimize_Alignment;
       Save.Optimize_Alignment_Local       := Optimize_Alignment_Local;
       Save.Persistent_BSS_Mode            := Persistent_BSS_Mode;
@@ -189,6 +192,7 @@ 
          Fast_Math                   := Fast_Math_Config;
          Init_Or_Norm_Scalars        := Init_Or_Norm_Scalars_Config;
          Initialize_Scalars          := Initialize_Scalars_Config;
+         Normalize_Scalars           := Normalize_Scalars_Config;
          Optimize_Alignment          := Optimize_Alignment_Config;
          Optimize_Alignment_Local    := False;
          Persistent_BSS_Mode         := Persistent_BSS_Mode_Config;
Index: opt.ads
===================================================================
--- opt.ads	(revision 177356)
+++ opt.ads	(working copy)
@@ -1730,6 +1730,13 @@ 
    --  This switch is not set when the pragma appears ahead of a given
    --  unit, so it does not affect the compilation of other units.
 
+   Normalize_Scalars_Config : Boolean;
+   --  GNAT
+   --  This is the value of the configuration switch that is set by the
+   --  pragma Normalize_Scalars when it appears in the gnat.adc file.
+   --  This switch is not set when the pragma appears ahead of a given
+   --  unit, so it does not affect the compilation of other units.
+
    Optimize_Alignment_Config : Character;
    --  GNAT
    --  This is the value of the configuration switch that controls the
@@ -1911,6 +1918,7 @@ 
       Fast_Math                      : Boolean;
       Init_Or_Norm_Scalars           : Boolean;
       Initialize_Scalars             : Boolean;
+      Normalize_Scalars              : Boolean;
       Optimize_Alignment             : Character;
       Optimize_Alignment_Local       : Boolean;
       Persistent_BSS_Mode            : Boolean;