OSDN Git Service

2010-06-17 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jun 2010 16:04:52 +0000 (16:04 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jun 2010 16:04:52 +0000 (16:04 +0000)
* sem_util.adb (Is_Atomic_Object): Predicate does not apply to
subprograms.

2010-06-17  Robert Dewar  <dewar@adacore.com>

* gnat_rm.texi, gnat_ugn.texi: Clean up documentation on warning and
style check messages.
* sem_res.adb (Resolve_Call): Don't call
Check_For_Eliminated_Subprogram if we are analyzing within a spec
expression.

2010-06-17  Robert Dewar  <dewar@adacore.com>

* debug.adb: Add documentation for debug flags .X and .Y
* exp_ch4.adb (Expand_Short_Circuit_Operator): Use
Use_Expression_With_Actions.
* gnat1drv.adb (Adjust_Global_Switches): Set
Use_Expression_With_Actions.
* opt.ads (Use_Expression_With_Actions): New switch.

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

gcc/ada/ChangeLog
gcc/ada/debug.adb
gcc/ada/exp_ch4.adb
gcc/ada/gnat1drv.adb
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/opt.ads
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb

index 275f160..88aa0a4 100644 (file)
@@ -1,3 +1,25 @@
+2010-06-17  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_util.adb (Is_Atomic_Object): Predicate does not apply to
+       subprograms.
+
+2010-06-17  Robert Dewar  <dewar@adacore.com>
+
+       * gnat_rm.texi, gnat_ugn.texi: Clean up documentation on warning and
+       style check messages.
+       * sem_res.adb (Resolve_Call): Don't call
+       Check_For_Eliminated_Subprogram if we are analyzing within a spec
+       expression.
+
+2010-06-17  Robert Dewar  <dewar@adacore.com>
+
+       * debug.adb: Add documentation for debug flags .X and .Y
+       * exp_ch4.adb (Expand_Short_Circuit_Operator): Use
+       Use_Expression_With_Actions.
+       * gnat1drv.adb (Adjust_Global_Switches): Set
+       Use_Expression_With_Actions.
+       * opt.ads (Use_Expression_With_Actions): New switch.
+
 2010-06-17  Robert Dewar  <dewar@adacore.com>
 
        * exp_intr.adb: Minor code reorganization (use UI_Max)
index 529fb33..ac8ed4a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -141,8 +141,8 @@ package body Debug is
    --  d.U
    --  d.V
    --  d.W  Print out debugging information for Walk_Library_Items
-   --  d.X  Use Expression_With_Actions for short-circuited forms
-   --  d.Y
+   --  d.X  Use Expression_With_Actions
+   --  d.Y  Do not use Expression_With_Actions
    --  d.Z
 
    --  d1   Error msgs have node numbers where possible
@@ -581,10 +581,15 @@ package body Debug is
 
    --  d.X  By default, the compiler uses an elaborate rewriting framework for
    --       short-circuited forms where the right hand condition generates
-   --       actions to be inserted. Use of this switch causes the compiler to
-   --       use the much simpler Expression_With_Actions node for this purpose.
-   --       It is a debug flag to aid transitional implementation in gigi and
-   --       the back end. As soon as that works fine, we will remove this flag.
+   --       actions to be inserted. With the gcc backend, we now use the new
+   --       N_Expression_With_Actions node for this expansion, but we still use
+   --       the old method for other backends and in SCIL mode. This debug flag
+   --       forces use of the new N_Expression_With_Actions node in these other
+   --       cases and is intended for transitional use.
+
+   --  d.Y  Prevents the use of the N_Expression_With_Actions node even in the
+   --       case of the gcc back end. Provided as a back up in case the new
+   --       scheme has problems.
 
    --  d1   Error messages have node numbers where possible. Normally error
    --       messages have only source locations. This option is useful when
index cb5c4c0..f7c781f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -8829,10 +8829,10 @@ package body Exp_Ch4 is
          --  of the introduction of the new variable C, which obscures the
          --  structure of the test.
 
-         --  We use this "old approach" by default for now, unless the
-         --  special debug switch gnatd.X is used.
+         --  We use this "old approach" if use of N_Expression_With_Actions
+         --  is False (see description in Opt of when this is or is not set).
 
-         if not Debug_Flag_Dot_XX then
+         if not Use_Expression_With_Actions then
             Op_Var := Make_Temporary (Loc, 'C', Related_Node => N);
 
             Insert_Action (N,
index 7982486..899b013 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -332,6 +332,33 @@ procedure Gnat1drv is
       else
          Suppress_Options (Overflow_Check) := True;
       end if;
+
+      --  Set switch indicating if we can use N_Expression_With_Actions
+
+      --  Debug flag -gnatd.X decisively sets usage on
+
+      if Debug_Flag_Dot_XX then
+         Use_Expression_With_Actions := True;
+
+      --  Debug flag -gnatd.Y decisively sets usage off
+
+      elsif Debug_Flag_Dot_YY then
+         Use_Expression_With_Actions := False;
+
+      --  If no debug flags, usage off for AAMP, VM, SCIL cases
+
+      elsif AAMP_On_Target
+        or else VM_Target /= No_VM
+        or else Generate_SCIL
+      then
+         Use_Expression_With_Actions := False;
+
+         --  Otherwise normal gcc back end, for now still turn usage off by
+         --  default.
+
+      else
+         Use_Expression_With_Actions := False;
+      end if;
    end Adjust_Global_Switches;
 
    --------------------
index 8e226c6..def4db1 100644 (file)
@@ -5247,6 +5247,9 @@ used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
 be useful in checking whether obsolete pragmas in existing programs are hiding
 real problems.
 
+Note: pragma Warnings does not affect the processing of style messages. See
+separate entry for pragma Style_Checks for control of style messages.
+
 @node Pragma Weak_External
 @unnumberedsec Pragma Weak_External
 @findex Weak_External
index 17e7fb9..274dc8c 100644 (file)
@@ -4201,7 +4201,7 @@ Note that @option{^-gnatg^/GNAT_INTERNAL^} implies
 @option{^-gnatwae^/WARNINGS=ALL,ERRORS^} and
 @option{^-gnatyg^/STYLE_CHECKS=GNAT^}
 so that all standard warnings and all standard style options are turned on.
-All warnings and style error messages are treated as errors.
+All warnings and style messages are treated as errors.
 
 @ifclear vms
 @item -gnatG=nn
@@ -5213,12 +5213,14 @@ This switch suppresses warnings for implicit dereferences in
 indexed components, slices, and selected components.
 
 @item -gnatwe
-@emph{Treat warnings as errors.}
+@emph{Treat warnings and style checks as errors.}
 @cindex @option{-gnatwe} (@command{gcc})
 @cindex Warnings, treat as error
-This switch causes warning messages to be treated as errors.
+This switch causes warning messages and style check messages to be
+treated as errors.
 The warning string still appears, but the warning messages are counted
-as errors, and prevent the generation of an object file.
+as errors, and prevent the generation of an object file. Note that this
+is the only -gnatw switch that affects the handling of style check messages.
 
 @item -gnatw.e
 @emph{Activate every optional warning}
@@ -5581,7 +5583,8 @@ This switch completely suppresses the
 output of all warning messages from the GNAT front end.
 Note that it does not suppress warnings from the @command{gcc} back end.
 To suppress these back end warnings as well, use the switch @option{-w}
-in addition to @option{-gnatws}.
+in addition to @option{-gnatws}. Also this switch has no effect on the
+handling of style check messages.
 
 @item -gnatwt
 @emph{Activate warnings for tracking of deleted conditional code.}
@@ -6140,8 +6143,10 @@ causes the compiler to
 enforce specified style rules. A limited set of style rules has been used
 in writing the GNAT sources themselves. This switch allows user programs
 to activate all or some of these checks. If the source program fails a
-specified style check, an appropriate warning message is given, preceded by
-the character sequence ``(style)''.
+specified style check, an appropriate message is given, preceded by
+the character sequence ``(style)''. This message does not prevent
+successful compilation (unless the @option{-gnatwe} switch is used).
+
 @ifset vms
 @code{(option,option,@dots{})} is a sequence of keywords
 @end ifset
index 562e6ab..9d0b2cd 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -453,8 +453,8 @@ package Opt is
                            Front_End_Setjmp_Longjmp_Exceptions;
    --  GNAT
    --  Set to the appropriate value depending on the default as given in
-   --  system.ads (ZCX_By_Default, GCC_ZCX_Support).
-   --  The C convention is there to make this variable accessible to gigi.
+   --  system.ads (ZCX_By_Default, GCC_ZCX_Support). The C convention is there
+   --  to make this variable accessible to gigi.
 
    Exception_Tracebacks : Boolean := False;
    --  GNATBIND
@@ -1239,6 +1239,13 @@ package Opt is
    --  Set to True if -h (-gnath for the compiler) switch encountered
    --  requesting usage information
 
+   Use_Expression_With_Actions : Boolean := False;
+   --  The N_Expression_With_Actions node has been introduced relatively
+   --  recently, and not all back ends are prepared to handle it yet. So
+   --  we use this flag to suppress its use during a transitional period.
+   --  Currently the default is False for all cases except the standard
+   --  GCC back end. The default can be modified using -gnatd.X/-gnatd.Y.
+
    Use_Pragma_Linker_Constructor : Boolean := False;
    --  GNATBIND
    --  True if pragma Linker_Constructor applies to adainit
index eaaa26f..aa551ac 100644 (file)
@@ -5447,9 +5447,14 @@ package body Sem_Res is
          Check_Potentially_Blocking_Operation (N);
       end if;
 
-      --  Issue an error for a call to an eliminated subprogram
+      --  Issue an error for a call to an eliminated subprogram. We skip this
+      --  in a spec expression, e.g. a call in a default parameter value, since
+      --  we are not really doing a call at this time. That's important because
+      --  the spec expression may itself belong to an eliminated subprogram.
 
-      Check_For_Eliminated_Subprogram (Subp, Nam);
+      if not In_Spec_Expression then
+         Check_For_Eliminated_Subprogram (Subp, Nam);
+      end if;
 
       --  All done, evaluate call and deal with elaboration issues
 
index 29ddee9..cc25e34 100644 (file)
@@ -5712,7 +5712,14 @@ package body Sem_Util is
    --  Start of processing for Is_Atomic_Object
 
    begin
-      if Is_Atomic (Etype (N))
+      --  Predicate is not relevant to subprograms
+
+      if Is_Entity_Name (N)
+        and then Is_Overloadable (Entity (N))
+      then
+         return False;
+
+      elsif Is_Atomic (Etype (N))
         or else (Is_Entity_Name (N) and then Is_Atomic (Entity (N)))
       then
          return True;