+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
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;
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;
with Snames;
with Sprint; use Sprint;
with Stringt;
+with Stylesw; use Stylesw;
with Targparm; use Targparm;
with Tree_Gen;
with Treepr; use Treepr;
with Uname; use Uname;
with Urealp;
with Usage;
+with Validsw; use Validsw;
with System.Assertions;
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
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
-- 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)
@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
-- 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;
-- 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
-- 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
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;
# define HAVE_TERMIOS
#endif
+#if defined (__vxworks)
+#include <vxWorks.h>
+#endif
+
#include "gsocket.h"
#ifdef DUMMY
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);
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
-- --
-- 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- --
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));
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' =>
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' =>
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?");