2009-07-13 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Jul 2009 12:45:02 +0000 (12:45 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Jul 2009 12:45:02 +0000 (12:45 +0000)
* exp_ch4.adb: Minor comment change

2009-07-13  Ed Schonberg  <schonberg@adacore.com>

* sem_ch5.adb (Analyze_Iteration_Scheme): Generate dummy reference for
type of iteration, to prevent spurious warnings.

2009-07-13  Nicolas Roche  <roche@adacore.com>

* s-oscons-tmplt.c: On VxWorks target ensure that vxWorks.h is always
included.

2009-07-13  Arnaud Charlet  <charlet@adacore.com>

* switch-c.adb, usage.adb, sem_ch9.adb, gnat_ugn.texi, rtsfind.adb,
gnat1drv.adb, opt.ads, sem_ch13.adb (Inspector_Mode): Renamed to
Generate_SCIL.
(CodePeer_Mode): New -gnatC switch.
(Adjust_Global_Switches): Adjust settings for Generate_SCIL and
CodePeer_Mode.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149578 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/ada/ChangeLog
gcc/ada/exp_ch4.adb
gcc/ada/gnat1drv.adb
gcc/ada/gnat_ugn.texi
gcc/ada/opt.ads
gcc/ada/rtsfind.adb
gcc/ada/s-oscons-tmplt.c
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch5.adb
gcc/ada/sem_ch9.adb
gcc/ada/switch-c.adb
gcc/ada/usage.adb

index 3d759ce..7e8d26d 100644 (file)
@@ -1,3 +1,26 @@
+2009-07-13  Robert Dewar  <dewar@adacore.com>
+
+       * exp_ch4.adb: Minor comment change
+
+2009-07-13  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch5.adb (Analyze_Iteration_Scheme): Generate dummy reference for
+       type of iteration, to prevent spurious warnings.
+
+2009-07-13  Nicolas Roche  <roche@adacore.com>
+
+       * s-oscons-tmplt.c: On VxWorks target ensure that vxWorks.h is always
+       included.
+
+2009-07-13  Arnaud Charlet  <charlet@adacore.com>
+
+       * switch-c.adb, usage.adb, sem_ch9.adb, gnat_ugn.texi, rtsfind.adb,
+       gnat1drv.adb, opt.ads, sem_ch13.adb (Inspector_Mode): Renamed to
+       Generate_SCIL.
+       (CodePeer_Mode): New -gnatC switch.
+       (Adjust_Global_Switches): Adjust settings for Generate_SCIL and
+       CodePeer_Mode.
+
 2009-07-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * checks.adb (Selected_Range_Checks): Do not consider that a non-static
index 624c878..3a0ab48 100644 (file)
@@ -7916,12 +7916,10 @@ package body Exp_Ch4 is
 
    begin
       --  Nothing at all to do if conversion is to the identical type so remove
-      --  the conversion completely, it is useless.
+      --  the conversion completely, it is useless, except that it may carry
+      --  an Assignment_OK attribute, which must be propagated to the operand.
 
       if Operand_Type = Target_Type then
-
-         --  Propagate Assignment_OK attribute to the operand
-
          if Assignment_OK (N) then
             Set_Assignment_OK (Operand);
          end if;
@@ -8514,12 +8512,10 @@ package body Exp_Ch4 is
 
    begin
       --  Nothing at all to do if conversion is to the identical type so remove
-      --  the conversion completely, it is useless.
+      --  the conversion completely, it is useless, except that it may carry
+      --  an Assignment_OK indication which must be proprgated to the operand.
 
       if Operand_Type = Target_Type then
-
-         --  Propagate Assignment_OK attribute to the operand
-
          if Assignment_OK (N) then
             Set_Assignment_OK (Operand);
          end if;
index 7c39819..b787556 100644 (file)
@@ -61,6 +61,7 @@ with Sinput.L; use Sinput.L;
 with Snames;
 with Sprint;   use Sprint;
 with Stringt;
+with Stylesw;  use Stylesw;
 with Targparm; use Targparm;
 with Tree_Gen;
 with Treepr;   use Treepr;
@@ -70,6 +71,7 @@ with Uintp;    use Uintp;
 with Uname;    use Uname;
 with Urealp;
 with Usage;
+with Validsw;  use Validsw;
 
 with System.Assertions;
 
@@ -108,6 +110,11 @@ procedure Gnat1drv is
 
    procedure Adjust_Global_Switches is
    begin
+      --  Debug flag -gnatd.I is a synonym of Generate_SCIL
+
+      if Debug_Flag_Dot_II then
+         Generate_SCIL := True;
+      end if;
 
       --  Set ASIS mode if -gnatt and -gnatc are set
 
@@ -122,19 +129,101 @@ procedure Gnat1drv is
 
          Inline_Active := False;
 
-         --  Turn off Inspector mode in ASIS mode, since Inspector requires
-         --  front-end expansion.
+         --  Turn off SCIL generation in ASIS mode, since SCIL requires front-
+         --  end expansion.
+
+         Generate_SCIL := False;
+      end if;
+
+      --  SCIL mode needs to disable front-end inlining since the generated
+      --  trees (in particular order and consistency between specs compiled
+      --  as part of a main unit or as part of a with-clause) are causing
+      --  troubles.
 
-         Inspector_Mode := False;
+      if Generate_SCIL then
+         Front_End_Inlining := False;
       end if;
 
-      --  Inspector mode needs to disable front-end inlining since the
-      --  generated trees (in particular order and consistency between specs
-      --  compiled as part of a main unit or as part of a with-clause) are
-      --  causing troubles.
+      --  Tune settings for optimal SCIL generation in CodePeer_Mode
+
+      if CodePeer_Mode then
+
+         --  Turn off inlining, confuses codepeer output and gains nothing
 
-      if Inspector_Mode then
          Front_End_Inlining := False;
+         Inline_Active      := False;
+
+         --  Turn off ASIS mode: incompatible with front-end expansion.
+
+         ASIS_Mode := False;
+
+         --  Turn off dynamic elaboration checks: generates inconsitencies in
+         --  trees between specs compiled as part of a main unit or as part of
+         --  a with-clause.
+
+         Dynamic_Elaboration_Checks := False;
+
+         --  Suppress overflow checks since this is handled implicitely by
+         --  codepeer. Enable all other language checks.
+
+         Suppress_Options       := (Overflow_Check => True, others => False);
+         Enable_Overflow_Checks := False;
+
+         --  Kill debug of generated code, since it messes up sloc values
+
+         Debug_Generated_Code := False;
+
+         --  Turn cross-referencing on in case it was disabled (by e.g. -gnatD)
+         --  Do we really need to spend time generating xref in codepeer
+         --  mode??? Consider setting Xref_Active to False.
+
+         Xref_Active := True;
+
+         --  Polling mode forced off, since it generates confusing junk
+
+         Polling_Required := False;
+
+         --  Set operating mode to check semantics with full front-end
+         --  expansion, but no back-end code generation.
+
+         Operating_Mode := Check_Semantics;
+         Debug_Flag_X   := True;
+
+         --  We need SCIL generation of course
+
+         Generate_SCIL := True;
+
+         --  Enable assertions and debug pragmas, since they give codepeer
+         --  valuable extra information.
+
+         Assertions_Enabled     := True;
+         Debug_Pragmas_Enabled  := True;
+
+         --  Suppress compiler warnings, since what we are interested in here
+         --  is what codepeer can find out. Also disable all simple value
+         --  propagation. This is an optimization which is valuable for code
+         --  optimization, and also for generation of compiler warnings, but
+         --  these are being turned off anyway, and codepeer understands
+         --  things more clearly if references are not optimized in this way.
+
+         Warning_Mode  := Suppress;
+         Debug_Flag_MM := True;
+
+         --  Set normal RM validity checking, and checking of IN OUT parameters
+         --  (this might give codepeer more useful checks to analyze, to be
+         --  confirmed???). All other validity checking is turned off, since
+         --  this can generate very complex trees that only confuse codepeer
+         --  and do not bring enough useful info.
+
+         Reset_Validity_Check_Options;
+         Validity_Check_Default       := True;
+         Validity_Check_In_Out_Params := True;
+         Validity_Check_In_Params     := True;
+
+         --  Turn off style check options since we are not interested in any
+         --  front-end warnings when we are getting code peer output.
+
+         Reset_Style_Check_Options;
       end if;
 
       --  Set Configurable_Run_Time mode if system.ads flag set
@@ -752,7 +841,7 @@ begin
       --  a VM, since representations are largely symbolic there.
 
       if Back_End_Mode = Declarations_Only
-        and then (not (Back_Annotate_Rep_Info or Inspector_Mode)
+        and then (not (Back_Annotate_Rep_Info or Generate_SCIL)
                    or else Main_Kind = N_Subunit
                    or else Targparm.Frontend_Layout_On_Target
                    or else Targparm.VM_Target /= No_VM)
index 08e6a6e..779a761 100644 (file)
@@ -4090,6 +4090,14 @@ Assume no invalid (bad) values except for 'Valid attribute use.
 @cindex @option{-gnatc} (@command{gcc})
 Check syntax and semantics only (no code generation attempted).
 
+@item -gnatC
+@cindex @option{-gnatC} (@command{gcc})
+Generate CodePeer information (no code generation attempted).
+This switch will generate an intermediate representation suitable for
+use by CodePeer (@file{.scil} files). This switch is not compatible with
+code generation (it will, among other things, disable some switches such
+as -gnatn, and enable others such as -gnata).
+
 @item -gnatd
 @cindex @option{-gnatd} (@command{gcc})
 Specify debug options for the compiler. The string of characters after
index f220136..906a782 100644 (file)
@@ -38,7 +38,6 @@
 --  use the Project Manager. These tools include gnatmake, gnatname, the gnat
 --  driver, gnatclean, gprbuild and gprclean.
 
-with Debug;
 with Hostparm; use Hostparm;
 with Types;    use Types;
 
@@ -257,6 +256,11 @@ package Opt is
    --  Set to True to enable checking for unused withs, and also the case
    --  of withing a package and using none of the entities in the package.
 
+   CodePeer_Mode : Boolean := False;
+   --  GNAT
+   --  Enable full CodePeer mode (SCIL generation, disable switches that
+   --  interact badly with it, etc...).
+
    Commands_To_Stdout : Boolean := False;
    --  GNATMAKE
    --  True if echoed commands to be written to stdout instead of stderr
@@ -637,12 +641,9 @@ package Opt is
    --  then elaboration flag checks are to be generated in the binder
    --  generated file.
 
-   Inspector_Mode : Boolean renames Debug.Debug_Flag_Dot_II;
+   Generate_SCIL : Boolean := False;
    --  GNAT
-   --  Set True to activate Inspector mode (-gnatd.I switch). In particular
-   --  this enables SCIL generation. When VM_Target /= None, the compiler will
-   --  also attempt to generate code even in case of unsupported construct
-   --  instead of displaying an error.
+   --  Set True to activate SCIL code generation.
 
    Invalid_Value_Used : Boolean := False;
    --  GNAT
index 450fdc0..32323fc 100644 (file)
@@ -799,12 +799,12 @@ package body Rtsfind is
    procedure Maybe_Add_With (U : in out RT_Unit_Table_Record) is
    begin
       --  We do not need to generate a with_clause for a call issued from
-      --  RTE_Component_Available. However, for Inspector, we need these
+      --  RTE_Component_Available. However, for CodePeer, we need these
       --  additional with's, because for a sequence like "if RTE_Available (X)
       --  then ... RTE (X)" the RTE call fails to create some necessary
       --  with's.
 
-      if RTE_Available_Call and then not Inspector_Mode then
+      if RTE_Available_Call and then not Generate_SCIL then
          return;
       end if;
 
index 694fcf1..6ec1b1e 100644 (file)
@@ -89,6 +89,10 @@ pragma Style_Checks ("M32766");
 # define HAVE_TERMIOS
 #endif
 
+#if defined (__vxworks)
+#include <vxWorks.h>
+#endif
+
 #include "gsocket.h"
 
 #ifdef DUMMY
index b763aa5..2ec5334 100644 (file)
@@ -1215,7 +1215,7 @@ package body Sem_Ch13 is
 
             if VM_Target = No_VM then
                Set_Has_External_Tag_Rep_Clause (U_Ent);
-            elsif not Inspector_Mode then
+            else
                Error_Msg_Name_1 := Attr;
                Error_Msg_N
                  ("% attribute unsupported in this configuration", Nam);
index 8402e33..fe7ffbc 100644 (file)
@@ -1832,6 +1832,11 @@ package body Sem_Ch5 is
 
                   Set_Ekind          (Id, E_Loop_Parameter);
                   Set_Etype          (Id, Etype (DS));
+
+                  --  Treat a range as an implicit reference to the type, to
+                  --  inhibit spurious warnings.
+
+                  Generate_Reference (Base_Type (Etype (DS)), N, ' ');
                   Set_Is_Known_Valid (Id, True);
 
                   --  The loop is not a declarative part, so the only entity
index 00ca88b..9a242d5 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2009, 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- --
@@ -1518,7 +1518,7 @@ package body Sem_Ch9 is
          Generate_Reference (Entry_Id, Entry_Name);
 
          if Present (First_Formal (Entry_Id)) then
-            if VM_Target = JVM_Target and then not Inspector_Mode then
+            if VM_Target = JVM_Target then
                Error_Msg_N
                  ("arguments unsupported in requeue statement",
                   First_Formal (Entry_Id));
index c860af4..f0acc45 100644 (file)
@@ -228,6 +228,12 @@ package body Switch.C is
                Ptr := Ptr + 1;
                Operating_Mode := Check_Semantics;
 
+            --  Processing for C switch
+
+            when 'C' =>
+               Ptr := Ptr + 1;
+               CodePeer_Mode := True;
+
             --  Processing for d switch
 
             when 'd' =>
@@ -358,6 +364,14 @@ package body Switch.C is
 
                      return;
 
+                  --  -gnateC switch (CodePeer SCIL generation)
+                  --  Not enabled for now, keep it for later???
+                  --  use -gnatd.I only for now
+
+                  --  when 'C' =>
+                  --     Ptr := Ptr + 1;
+                  --     Generate_SCIL := True;
+
                   --  -gnateD switch (preprocessing symbol definition)
 
                   when 'D' =>
index 136f554..47e7899 100644 (file)
@@ -150,6 +150,11 @@ begin
    Write_Switch_Char ("c");
    Write_Line ("Check syntax and semantics only (no code generation)");
 
+   --  Line for -gnatC switch
+
+   Write_Switch_Char ("C");
+   Write_Line ("Generate CodePeer information (no code generation)");
+
    --  Line for -gnatd switch
 
    Write_Switch_Char ("d?");