[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 11 Apr 2013 12:58:54 +0000 (14:58 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 11 Apr 2013 12:58:54 +0000 (14:58 +0200)
2013-04-11  Eric Botcazou  <ebotcazou@adacore.com>

* init.c (RETURN_ADDR_OFFSET): Delete as unused.

2013-04-11  Robert Dewar  <dewar@adacore.com>

* a-crbtgk.adb, a-ciorse.adb, a-crbtgo.adb, a-coorse.adb, a-rbtgbo.adb,
a-cborse.adb, a-rbtgso.adb, exp_ch3.adb: Minor reformatting.

2013-04-11  Yannick Moy  <moy@adacore.com>

* exp_ch4.adb (Expand_N_Selected_Component): Do not expand
discriminant check for Unchecked_Union.
* sem_res.adb (Resolve_Selected_Component): Set flag
Do_Discriminant_Check even when expansion is not performed.
* sinfo.ads (Do_Discriminant_Check): Update documentation for the case
of Unchecked_Union.

2013-04-11  Thomas Quinot  <quinot@adacore.com>

* sem_ch13.adb (Same_Representation): Two types with different scalar
storage order never have the same representation.

2013-04-11  Arnaud Charlet  <charlet@adacore.com>

* xgnatugn.adb (Push_Conditional): Simplify handling,
no longer need to keep track of "excluding" sections.
(Currently_Excluding): Removed.
(Process_Source_File):
Set unw/vms flag so that texinfo can do the whole handling of
@ifset/@ifclear sections.  Fix handling of nested @ifset/@ifclear
sections.
* gnat_ugn.texi: Add a section on performing unassisted install
on Windows.

From-SVN: r197785

16 files changed:
gcc/ada/ChangeLog
gcc/ada/a-cborse.adb
gcc/ada/a-ciorse.adb
gcc/ada/a-coorse.adb
gcc/ada/a-crbtgk.adb
gcc/ada/a-crbtgo.adb
gcc/ada/a-rbtgbo.adb
gcc/ada/a-rbtgso.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch4.adb
gcc/ada/gnat_ugn.texi
gcc/ada/init.c
gcc/ada/sem_ch13.adb
gcc/ada/sem_res.adb
gcc/ada/sinfo.ads
gcc/ada/xgnatugn.adb

index 19a4700..e1125f7 100644 (file)
@@ -1,3 +1,38 @@
+2013-04-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * init.c (RETURN_ADDR_OFFSET): Delete as unused.
+
+2013-04-11  Robert Dewar  <dewar@adacore.com>
+
+       * a-crbtgk.adb, a-ciorse.adb, a-crbtgo.adb, a-coorse.adb, a-rbtgbo.adb,
+       a-cborse.adb, a-rbtgso.adb, exp_ch3.adb: Minor reformatting.
+
+2013-04-11  Yannick Moy  <moy@adacore.com>
+
+       * exp_ch4.adb (Expand_N_Selected_Component): Do not expand
+       discriminant check for Unchecked_Union.
+       * sem_res.adb (Resolve_Selected_Component): Set flag
+       Do_Discriminant_Check even when expansion is not performed.
+       * sinfo.ads (Do_Discriminant_Check): Update documentation for the case
+       of Unchecked_Union.
+
+2013-04-11  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_ch13.adb (Same_Representation): Two types with different scalar
+       storage order never have the same representation.
+
+2013-04-11  Arnaud Charlet  <charlet@adacore.com>
+
+       * xgnatugn.adb (Push_Conditional): Simplify handling,
+       no longer need to keep track of "excluding" sections.
+       (Currently_Excluding): Removed.
+       (Process_Source_File):
+       Set unw/vms flag so that texinfo can do the whole handling of
+       @ifset/@ifclear sections.  Fix handling of nested @ifset/@ifclear
+       sections.
+       * gnat_ugn.texi: Add a section on performing unassisted install
+       on Windows.
+
 2013-04-11  Johannes Kanig  <kanig@adacore.com>
 
        * debug.adb: Document usage of -gnatd.Q switch.
index ed34b69..64220f9 100644 (file)
@@ -1768,6 +1768,7 @@ package body Ada.Containers.Bounded_Ordered_Sets is
 
          L := L - 1;
          B := B - 1;
+
       exception
          when others =>
             L := L - 1;
@@ -1776,6 +1777,7 @@ package body Ada.Containers.Bounded_Ordered_Sets is
       end;
 
       if Compare then
+
          --  Item is equivalent to the node's element, so we will not have to
          --  move the node.
 
@@ -1808,6 +1810,7 @@ package body Ada.Containers.Bounded_Ordered_Sets is
 
             L := L - 1;
             B := B - 1;
+
          exception
             when others =>
                L := L - 1;
@@ -1815,7 +1818,10 @@ package body Ada.Containers.Bounded_Ordered_Sets is
                raise;
          end;
 
-         if not Compare then  -- Item is equivalent to Nodes (Hint).Element
+         --  Item is equivalent to Nodes (Hint).Element
+
+         if not Compare then
+
             --  Ceiling returns an element that is equivalent or greater than
             --  Item. If Item is "not less than" the element, then by
             --  elimination we know that Item is equivalent to the element.
index 4d918a5..3b1ffb4 100644 (file)
@@ -494,14 +494,13 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
    procedure Delete (Container : in out Set; Item : Element_Type) is
       X : Node_Access := Element_Keys.Find (Container.Tree, Item);
-
    begin
       if X = null then
          raise Constraint_Error with "attempt to delete element not in set";
+      else
+         Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
+         Free (X);
       end if;
-
-      Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
-      Free (X);
    end Delete;
 
    ------------------
@@ -1924,6 +1923,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
          L := L - 1;
          B := B - 1;
+
       exception
          when others =>
             L := L - 1;
@@ -1975,6 +1975,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
             L := L - 1;
             B := B - 1;
+
          exception
             when others =>
                L := L - 1;
@@ -1982,10 +1983,13 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
                raise;
          end;
 
-         if not Compare then  -- Item >= Hint.Element
-            --  Ceiling returns an element that is equivalent or greater than
-            --  Item. If Item is "not less than" the element, then by
-            --  elimination we know that Item is equivalent to the element.
+         --  Item >= Hint.Element
+
+         if not Compare then
+
+            --  Ceiling returns an element that is equivalent or greater
+            --  than Item. If Item is "not less than" the element, then
+            --  by elimination we know that Item is equivalent to the element.
 
             --  But this means that it is not possible to assign the value of
             --  Item to the specified element (on Node), because a different
index 3f25373..43d4ec9 100644 (file)
@@ -1757,6 +1757,7 @@ package body Ada.Containers.Ordered_Sets is
 
          L := L - 1;
          B := B - 1;
+
       exception
          when others =>
             L := L - 1;
@@ -1797,6 +1798,7 @@ package body Ada.Containers.Ordered_Sets is
 
             L := L - 1;
             B := B - 1;
+
          exception
             when others =>
                L := L - 1;
@@ -1804,10 +1806,13 @@ package body Ada.Containers.Ordered_Sets is
                raise;
          end;
 
-         if not Compare then  -- Item >= Hint.Element
-            --  Ceiling returns an element that is equivalent or greater than
-            --  Item. If Item is "not less than" the element, then by
-            --  elimination we know that Item is equivalent to the element.
+         --  Item >= Hint.Element
+
+         if not Compare then
+
+            --  Ceiling returns an element that is equivalent or greater
+            --  than Item. If Item is "not less than" the element, then
+            --  by elimination we know that Item is equivalent to the element.
 
             --  But this means that it is not possible to assign the value of
             --  Item to the specified element (on Node), because a different
index 0e27e0a..f1762f8 100644 (file)
@@ -65,6 +65,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
       L := L - 1;
 
       return Y;
+
    exception
       when others =>
          B := B - 1;
@@ -116,6 +117,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
       L := L - 1;
 
       return Result;
+
    exception
       when others =>
          B := B - 1;
@@ -155,6 +157,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
       L := L - 1;
 
       return Y;
+
    exception
       when others =>
          B := B - 1;
@@ -214,6 +217,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
 
          L := L - 1;
          B := B - 1;
+
       exception
          when others =>
             L := L - 1;
@@ -258,6 +262,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
 
          L := L - 1;
          B := B - 1;
+
       exception
          when others =>
             L := L - 1;
@@ -321,11 +326,12 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
             B := B + 1;
             L := L + 1;
 
-            Compare := Tree.Last = null
-                         or else Is_Greater_Key_Node (Key, Tree.Last);
+            Compare :=
+              Tree.Last = null or else Is_Greater_Key_Node (Key, Tree.Last);
 
             L := L - 1;
             B := B - 1;
+
          exception
             when others =>
                L := L - 1;
@@ -370,6 +376,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
 
          L := L - 1;
          B := B - 1;
+
       exception
          when others =>
             L := L - 1;
@@ -395,6 +402,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
 
             L := L - 1;
             B := B - 1;
+
          exception
             when others =>
                L := L - 1;
@@ -418,11 +426,11 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
          return;
       end if;
 
-      --  We know that Key isn't less than the hint so we try again,
-      --  this time to see if it's greater than the hint. If so we
-      --  compare Key to the node that follows the hint. If Key is both
-      --  greater than the hint and less than the hint's next neighbor,
-      --  then we're done; otherwise we must search.
+      --  We know that Key isn't less than the hint so we try again, this time
+      --  to see if it's greater than the hint. If so we compare Key to the
+      --  node that follows the hint. If Key is both greater than the hint and
+      --  less than the hint's next neighbor, then we're done; otherwise we
+      --  must search.
 
       begin
          B := B + 1;
@@ -432,6 +440,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
 
          L := L - 1;
          B := B - 1;
+
       exception
          when others =>
             L := L - 1;
@@ -457,6 +466,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
 
             L := L - 1;
             B := B - 1;
+
          exception
             when others =>
                L := L - 1;
@@ -480,10 +490,9 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
          return;
       end if;
 
-      --  We know that Key is neither less than the hint nor greater
-      --  than the hint, and that's the definition of equivalence.
-      --  There's nothing else we need to do, since a search would just
-      --  reach the same conclusion.
+      --  We know that Key is neither less than the hint nor greater than the
+      --  hint, and that's the definition of equivalence. There's nothing else
+      --  we need to do, since a search would just reach the same conclusion.
 
       Node := Position;
       Inserted := False;
index adc9ab2..6cce55d 100644 (file)
@@ -675,6 +675,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
       LR := LR - 1;
 
       return Result;
+
    exception
       when others =>
          BL := BL - 1;
index 2710620..d1c2677 100644 (file)
@@ -654,6 +654,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations is
       LR := LR - 1;
 
       return Result;
+
    exception
       when others =>
          BL := BL - 1;
index 700832e..06a78e9 100644 (file)
@@ -149,6 +149,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
 
             BS := BS - 1;
             LS := LS - 1;
+
          exception
             when others =>
                BT := BT - 1;
@@ -265,6 +266,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
          LR := LR - 1;
 
          return Tree;
+
       exception
          when others =>
             BL := BL - 1;
@@ -340,6 +342,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
 
             BS := BS - 1;
             LS := LS - 1;
+
          exception
             when others =>
                BT := BT - 1;
@@ -447,6 +450,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
          LR := LR - 1;
 
          return Tree;
+
       exception
          when others =>
             BL := BL - 1;
@@ -532,6 +536,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
          LR := LR - 1;
 
          return Result;
+
       exception
          when others =>
             BL := BL - 1;
@@ -605,6 +610,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
          LR := LR - 1;
 
          return Result;
+
       exception
          when others =>
             BL := BL - 1;
@@ -689,6 +695,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
 
             BS := BS - 1;
             LS := LS - 1;
+
          exception
             when others =>
                BT := BT - 1;
@@ -826,6 +833,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
          LR := LR - 1;
 
          return Tree;
+
       exception
          when others =>
             BL := BL - 1;
@@ -886,6 +894,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
 
          BS := BS - 1;
          LS := LS - 1;
+
       exception
          when others =>
             BS := BS - 1;
@@ -957,6 +966,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
          LR := LR - 1;
 
          return Tree;
+
       exception
          when others =>
             BL := BL - 1;
index 35d7a9f..980cc3c 100644 (file)
@@ -4846,9 +4846,8 @@ package body Exp_Ch3 is
 
       begin
          Full_Type := Typ;
-         if Is_Private_Type (Typ)
-           and then Present (Full_View (Typ))
-         then
+
+         if Is_Private_Type (Typ) and then Present (Full_View (Typ)) then
             Full_Type := Full_View (Typ);
          end if;
 
@@ -5169,9 +5168,9 @@ package body Exp_Ch3 is
                     (N, New_Copy_Tree (Init_Expr, New_Scope => Current_Scope));
                   return;
 
-               --  If type has discriminants, try to build equivalent
-               --  aggregate using discriminant values from the declaration.
-               --  This is a useful optimization, in particular if restriction
+               --  If type has discriminants, try to build equivalent aggregate
+               --  using discriminant values from the declaration. This
+               --  is a useful optimization, in particular if restriction
                --  No_Elaboration_Code is active.
 
                elsif Build_Equivalent_Aggregate then
index be5d17f..3a70183 100644 (file)
@@ -9198,6 +9198,7 @@ package body Exp_Ch4 is
       Loc   : constant Source_Ptr := Sloc (N);
       Par   : constant Node_Id    := Parent (N);
       P     : constant Node_Id    := Prefix (N);
+      S     : constant Node_Id    := Selector_Name (N);
       Ptyp  : Entity_Id           := Underlying_Type (Etype (P));
       Disc  : Entity_Id;
       New_N : Node_Id;
@@ -9273,18 +9274,27 @@ package body Exp_Ch4 is
       --  Deal with discriminant check required
 
       if Do_Discriminant_Check (N) then
+         if Present (Discriminant_Checking_Func
+                      (Original_Record_Component (Entity (S))))
+         then
+            --  Present the discriminant checking function to the backend, so
+            --  that it can inline the call to the function.
+
+            Add_Inlined_Body
+              (Discriminant_Checking_Func
+                (Original_Record_Component (Entity (S))));
 
-         --  Present the discriminant checking function to the backend, so that
-         --  it can inline the call to the function.
+            --  Now reset the flag and generate the call
 
-         Add_Inlined_Body
-           (Discriminant_Checking_Func
-             (Original_Record_Component (Entity (Selector_Name (N)))));
+            Set_Do_Discriminant_Check (N, False);
+            Generate_Discriminant_Check (N);
 
-         --  Now reset the flag and generate the call
+         --  In the case of Unchecked_Union, no discriminant checking is
+         --  actually performed.
 
-         Set_Do_Discriminant_Check (N, False);
-         Generate_Discriminant_Check (N);
+         else
+            Set_Do_Discriminant_Check (N, False);
+         end if;
       end if;
 
       --  Ada 2005 (AI-318-02): If the prefix is a call to a build-in-place
index dadf4d1..519890f 100644 (file)
@@ -655,7 +655,11 @@ Compatibility and Porting Guide
 @ifset unw
 Microsoft Windows Topics
 
+@ifclear FSFEDITION
+* Installing from the Command Line::
+@end ifclear
 * Using GNAT on Windows::
+* Using a network installation of GNAT::
 * CONSOLE and WINDOWS subsystems::
 * Temporary Files::
 * Mixed-Language Programming on Windows::
@@ -29091,6 +29095,9 @@ This chapter describes topics that are specific to the Microsoft Windows
 platforms (NT, 2000, and XP Professional).
 
 @menu
+@ifclear FSFEDITION
+* Installing from the Command Line::
+@end ifclear
 * Using GNAT on Windows::
 * Using a network installation of GNAT::
 * CONSOLE and WINDOWS subsystems::
@@ -29108,6 +29115,54 @@ platforms (NT, 2000, and XP Professional).
 * Setting Heap Size from gnatlink::
 @end menu
 
+@ifclear FSFEDITION
+@node Installing from the Command Line
+@section Installing from the Command Line
+@cindex Batch installation
+@cindex Silent installation
+@cindex Unassisted installation
+
+@noindent
+By default the @value{EDITION} installers display a GUI that prompts the user
+to enter installation path and similar information, and guide him through the
+installation process. It is also possible to perform silent installations
+using the command-line interface.
+
+In order to install one of the @value{EDITION} installers from the command
+line you should pass parameter @code{/S} (and, optionally,
+@code{/D=<directory>}) as command-line arguments.
+
+@ifset PROEDITION
+For example, for an unattended installation of
+@value{EDITION} 7.0.2 into the default directory
+@code{C:\GNATPRO\7.0.2} you would run:
+
+@smallexample
+gnatpro-7.0.2-i686-pc-mingw32-bin.exe /S
+@end smallexample
+
+To install into a custom directory, say, @code{C:\TOOLS\GNATPRO\7.0.2}:
+
+@smallexample
+gnatpro-7.0.2-i686-pc-mingw32-bin /S /D=C:\TOOLS\GNATPRO\7.0.2
+@end smallexample
+@end ifset
+
+@ifset GPLEDITION
+For example, for an unattended installation of
+@value{EDITION} 2012 into @code{C:\GNAT\2012}:
+
+@smallexample
+gnat-gpl-2012-i686-pc-mingw32-bin /S /D=C:\GNAT\2012
+@end smallexample
+@end ifset
+
+You can use the same syntax for all installers.
+
+Note that unattended installations don't modify system path, nor create file
+associations, so such activities need to be done by hand.
+@end ifclear
+
 @node Using GNAT on Windows
 @section Using GNAT on Windows
 
index ef9087c..8473ff0 100644 (file)
@@ -711,15 +711,6 @@ __gnat_install_handler(void)
 #include <sys/ucontext.h>
 #include <sys/regset.h>
 
-/* The code below is common to SPARC and x86.  Beware of the delay slot
-   differences for signal context adjustments.  */
-
-#if defined (__sparc)
-#define RETURN_ADDR_OFFSET 8
-#else
-#define RETURN_ADDR_OFFSET 0
-#endif
-
 static void
 __gnat_error_handler (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED)
 {
index 6c19a55..832e7c2 100644 (file)
@@ -9448,12 +9448,16 @@ package body Sem_Ch13 is
          return False;
       end if;
 
-      --  Representations are different if component alignments differ
+      --  Representations are different if component alignments or scalar
+      --  storage orders differ.
 
       if (Is_Record_Type (T1) or else Is_Array_Type (T1))
         and then
          (Is_Record_Type (T2) or else Is_Array_Type (T2))
-        and then Component_Alignment (T1) /= Component_Alignment (T2)
+        and then
+         (Component_Alignment (T1) /= Component_Alignment (T2)
+            or else
+          Reverse_Storage_Order (T1) /= Reverse_Storage_Order (T2))
       then
          return False;
       end if;
@@ -9530,7 +9534,7 @@ package body Sem_Ch13 is
 
                function Same_Rep return Boolean;
                --  CD1 and CD2 are either components or discriminants. This
-               --  function tests whether the two have the same representation
+               --  function tests whether they have the same representation.
 
                --------------
                -- Same_Rep --
@@ -9540,8 +9544,11 @@ package body Sem_Ch13 is
                begin
                   if No (Component_Clause (CD1)) then
                      return No (Component_Clause (CD2));
-
                   else
+                     --  Note: at this point, component clauses have been
+                     --  normalized to the default bit order, so that the
+                     --  comparison of Component_Bit_Offsets is meaningful.
+
                      return
                         Present (Component_Clause (CD2))
                           and then
index c93b752..c6e8dca 100644 (file)
@@ -8798,8 +8798,6 @@ package body Sem_Res is
         and then Ekind_In (Entity (S), E_Component, E_Discriminant)
         and then Present (Original_Record_Component (Entity (S)))
         and then Ekind (Original_Record_Component (Entity (S))) = E_Component
-        and then Present (Discriminant_Checking_Func
-                           (Original_Record_Component (Entity (S))))
         and then not Discriminant_Checks_Suppressed (T)
         and then not Init_Component
       then
index 59c60b9..3be0f58 100644 (file)
@@ -807,7 +807,10 @@ package Sinfo is
    --    This flag is set on N_Selected_Component nodes to indicate that a
    --    discriminant check is required using the discriminant check routine
    --    associated with the selector. The actual check is generated by the
-   --    expander when processing selected components.
+   --    expander when processing selected components. In the case of
+   --    Unchecked_Union, the flag is also set, but no discriminant check
+   --    routine is associated with the selector, and the expander does not
+   --    generate a check.
 
    --  Do_Division_Check (Flag13-Sem)
    --    This flag is set on a division operator (/ mod rem) to indicate
index ab16817..3403ad4 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-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- --
@@ -129,6 +129,7 @@ procedure Xgnatugn is
    procedure Put_Line (F : Sfile; S : String);
    --  Local version of Put_Line ensures Unix style line endings
 
+   First_Time         : Boolean := True;
    Number_Of_Warnings : Natural := 0;
    Number_Of_Errors   : Natural := 0;
    Warnings_Enabled   : Boolean;
@@ -237,15 +238,11 @@ procedure Xgnatugn is
    --  It relies on information in Source_File to generate error messages.
 
    type Conditional is (Set, Clear);
-   procedure Push_Conditional (Cond : Conditional; Flag : Target_Type);
+   procedure Push_Conditional (Cond : Conditional; Flag : Flag_Type);
    procedure Pop_Conditional  (Cond : Conditional);
    --  These subprograms deal with conditional processing (@ifset/@ifclear).
    --  They rely on information in Source_File to generate error messages.
 
-   function Currently_Excluding return Boolean;
-   --  Returns true if conditional processing directives imply that the
-   --  current line should not be included in the output.
-
    function VMS_Context_Determined return Boolean;
    --  Returns true if, in the current conditional preprocessing context, we
    --  always have a VMS or a non-VMS version, regardless of the value of
@@ -266,7 +263,6 @@ procedure Xgnatugn is
       Starting_Line : Positive;
       Cond          : Conditional;
       Flag          : Flag_Type;
-      Excluding     : Boolean;
    end record;
 
    Conditional_Stack_Depth : constant := 3;
@@ -972,6 +968,14 @@ procedure Xgnatugn is
                            Error (Source_File, "flag has to be lowercase");
                         end if;
 
+                        --  Set unw/vms flag in the output file so that
+                        --  @ifset/@ifclear will work as expected.
+
+                        if First_Time then
+                           Put_Line (Output_File, "@set " & Argument (1));
+                           First_Time := False;
+                        end if;
+
                      when Edition_Type =>
                         null;
                   end case;
@@ -1002,6 +1006,14 @@ procedure Xgnatugn is
                            Error (Source_File, "flag has to be lowercase");
                         end if;
 
+                        --  Set unw/vms flag in the output file so that
+                        --  @ifset/@ifclear will work as expected.
+
+                        if First_Time then
+                           Put_Line (Output_File, "@set " & Argument (1));
+                           First_Time := False;
+                        end if;
+
                      when Edition_Type =>
                         null;
                   end case;
@@ -1011,8 +1023,7 @@ procedure Xgnatugn is
                end;
             end if;
 
-            if Have_Conditional and (Flag in Target_Type) then
-
+            if Have_Conditional then
                --  We create a new conditional context and suppress the
                --  directive in the output.
 
@@ -1020,7 +1031,6 @@ procedure Xgnatugn is
 
             elsif Line'Length >= Endsetclear'Length
               and then Line (1 .. Endsetclear'Length) = Endsetclear
-              and then (Flag in Target_Type)
             then
                --  The '@end ifset'/'@end ifclear' case is handled here. We
                --  have to pop the conditional context.
@@ -1049,6 +1059,10 @@ procedure Xgnatugn is
 
                      if Have_Conditional then
                         Pop_Conditional (Cond);
+
+                        if Conditional_TOS > 0 then
+                           Flag := Conditional_Stack (Conditional_TOS).Flag;
+                        end if;
                      end if;
 
                      --  We fall through to the ordinary case for other @end
@@ -1058,14 +1072,7 @@ procedure Xgnatugn is
                end;
             end if;                     --  Have_Conditional
 
-            if (not Have_Conditional) or (Flag in Edition_Type) then
-
-               --  The ordinary case
-
-               if not Currently_Excluding then
-                  Put_Line (Output_File, Rewritten);
-               end if;
-            end if;
+            Put_Line (Output_File, Rewritten);
          end;
       end loop;
 
@@ -1156,42 +1163,27 @@ procedure Xgnatugn is
    -- Push_Conditional --
    ----------------------
 
-   procedure Push_Conditional (Cond : Conditional; Flag : Target_Type) is
-      Will_Exclude : Boolean;
-
+   procedure Push_Conditional (Cond : Conditional; Flag : Flag_Type) is
    begin
-      --  If we are already in an excluding context, inherit this property,
-      --  otherwise calculate it from scratch.
+      if Flag in Target_Type then
 
-      if Conditional_TOS > 0
-        and then Conditional_Stack (Conditional_TOS).Excluding
-      then
-         Will_Exclude := True;
-      else
-         case Cond is
-            when Set =>
-               Will_Exclude := Flag /= Target;
-            when Clear =>
-               Will_Exclude := Flag = Target;
-         end case;
-      end if;
+         --  Check if the current directive is pointless because of a previous,
+         --  enclosing directive.
 
-      --  Check if the current directive is pointless because of a previous,
-      --  enclosing directive.
-
-      for J in 1 .. Conditional_TOS loop
-         if Conditional_Stack (J).Flag = Flag then
-            Warning (Source_File, "directive without effect because of line"
-                     & Integer'Image (Conditional_Stack (J).Starting_Line));
-         end if;
-      end loop;
+         for J in 1 .. Conditional_TOS loop
+            if Conditional_Stack (J).Flag = Flag then
+               Warning
+                 (Source_File, "directive without effect because of line"
+                 & Integer'Image (Conditional_Stack (J).Starting_Line));
+            end if;
+         end loop;
+      end if;
 
       Conditional_TOS := Conditional_TOS + 1;
       Conditional_Stack (Conditional_TOS) :=
         (Starting_Line => Source_File.Line,
          Cond          => Cond,
-         Flag          => Flag,
-         Excluding     => Will_Exclude);
+         Flag          => Flag);
    end Push_Conditional;
 
    ---------------------
@@ -1234,16 +1226,6 @@ procedure Xgnatugn is
       end if;
    end Pop_Conditional;
 
-   -------------------------
-   -- Currently_Excluding --
-   -------------------------
-
-   function Currently_Excluding return Boolean is
-   begin
-      return Conditional_TOS > 0
-        and then Conditional_Stack (Conditional_TOS).Excluding;
-   end Currently_Excluding;
-
    ----------------------------
    -- VMS_Context_Determined --
    ----------------------------