[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 27 Apr 2017 10:12:12 +0000 (12:12 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 27 Apr 2017 10:12:12 +0000 (12:12 +0200)
2017-04-27  Jerome Lambourg  <lambourg@adacore.com>

* bindusg.adb, bindgen.adb, gnatbind.adb, opt.ads: add -nognarl switch.

2017-04-27  Justin Squirek  <squirek@adacore.com>

* exp_ch7.adb (Build_Finalize_Statements): Move Num_Comps to
Process_Component_List_For_Finalization as a local variable.
(Process_Component_For_Finalize): Add an extra parameter to avoid
global references.
(Process_Component_List_For_Finalization): Correct calls to
Process_Component_For_Finalize to take Num_Comps as a parameter.

From-SVN: r247310

gcc/ada/ChangeLog
gcc/ada/bindgen.adb
gcc/ada/bindusg.adb
gcc/ada/exp_ch7.adb
gcc/ada/gnatbind.adb
gcc/ada/opt.ads

index 89c28e8..80902e5 100644 (file)
@@ -1,3 +1,16 @@
+2017-04-27  Jerome Lambourg  <lambourg@adacore.com>
+
+       * bindusg.adb, bindgen.adb, gnatbind.adb, opt.ads: add -nognarl switch.
+
+2017-04-27  Justin Squirek  <squirek@adacore.com>
+
+       * exp_ch7.adb (Build_Finalize_Statements): Move Num_Comps to
+       Process_Component_List_For_Finalization as a local variable.
+       (Process_Component_For_Finalize): Add an extra parameter to avoid
+       global references.
+       (Process_Component_List_For_Finalization): Correct calls to
+       Process_Component_For_Finalize to take Num_Comps as a parameter.
+
 2017-04-27  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * sem_ch8.adb (Find_Direct_Name): Account for the case where
index 59b43e0..7e3e981 100644 (file)
@@ -2853,7 +2853,9 @@ package body Bindgen is
          --  used: System.OS_Interface should always be used by any tasking
          --  application.
 
-         Check_Package (With_GNARL, "system.os_interface%s");
+         if not Opt.No_Libgnarl then
+            Check_Package (With_GNARL, "system.os_interface%s");
+         end if;
 
          --  Ditto for the use of restricted tasking
 
index 9da8ce9..ceaa264 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2017, 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- --
@@ -60,136 +60,166 @@ package body Bindusg is
 
       --  Line for @response_file
 
-      Write_Line ("  @<resp_file> Get arguments from response file");
+      Write_Line
+        ("  @<resp_file> Get arguments from response file");
       Write_Eol;
 
       --  Line for -aO switch
 
-      Write_Line ("  -aOdir    Specify library files search path");
+      Write_Line
+        ("  -aOdir    Specify library files search path");
 
       --  Line for -aI switch
 
-      Write_Line ("  -aIdir    Specify source files search path");
+      Write_Line
+        ("  -aIdir    Specify source files search path");
 
       --  Line for a switch
 
-      Write_Line ("  -a        Automatically initialize elaboration " &
-                  "procedure");
+      Write_Line
+        ("  -a        Automatically initialize elaboration procedure");
 
       --  Lines for -A switch
 
-      Write_Line ("  -A        Give list of ALI files in partition");
-      Write_Line ("  -A=file   Write ALI file list to named file");
+      Write_Line
+        ("  -A        Give list of ALI files in partition");
+      Write_Line
+        ("  -A=file   Write ALI file list to named file");
 
       --  Line for -b switch
 
-      Write_Line ("  -b        Generate brief messages to stderr " &
-                  "even if verbose mode set");
+      Write_Line
+        ("  -b        Generate brief messages to stderr even if verbose mode "
+         & "set");
 
       --  Line for -c switch
 
-      Write_Line ("  -c        Check only, no generation of " &
-                  "binder output file");
+      Write_Line
+        ("  -c        Check only, no generation of binder output file");
 
       --  Line for -d switch
 
-      Write_Line ("  -dnn[k|m] Default primary stack " &
-                  "size = nn [kilo|mega] bytes");
+      Write_Line
+        ("  -dnn[k|m] Default primary stack size = nn [kilo|mega] bytes");
 
       --  Line for D switch
 
-      Write_Line ("  -Dnn[k|m] Default secondary stack " &
-                  "size = nn [kilo|mega] bytes");
+      Write_Line
+        ("  -Dnn[k|m] Default secondary stack size = nn [kilo|mega] bytes");
 
       --  Line for -e switch
 
-      Write_Line ("  -e        Output complete list of elaboration " &
-                  "order dependencies");
+      Write_Line
+        ("  -e        Output complete list of elaboration order dependencies");
 
       --  Line for -E switch
 
-      Write_Line ("  -Ea       Store tracebacks in exception occurrences");
-      Write_Line ("  -Es       Store tracebacks in exception occurrences,");
-      Write_Line ("            and enable symbolic tracebacks");
-      Write_Line ("  -E        Same as -Ea");
+      Write_Line
+        ("  -Ea       Store tracebacks in exception occurrences");
+      Write_Line
+        ("  -Es       Store tracebacks in exception occurrences,");
+      Write_Line
+        ("            and enable symbolic tracebacks");
+      Write_Line
+        ("  -E        Same as -Ea");
 
       --  Line for -f switch
 
-      Write_Line ("  -ffile    Force elaboration order from given file");
+      Write_Line
+        ("  -ffile    Force elaboration order from given file");
 
       --  Line for -F switch
 
-      Write_Line ("  -F        Force checking of elaboration Flags");
+      Write_Line
+        ("  -F        Force checking of elaboration Flags");
 
       --  Line for -h switch
 
-      Write_Line ("  -h        Output this usage (help) information");
+      Write_Line
+        ("  -h        Output this usage (help) information");
 
       --  Lines for -I switch
 
-      Write_Line ("  -Idir     Specify library and source files search path");
-      Write_Line ("  -I-       Don't look for sources & library files " &
-                  "in default directory");
+      Write_Line
+        ("  -Idir     Specify library and source files search path");
+      Write_Line
+        ("  -I-       Don't look for sources & library files in default "
+         & "directory");
 
       --  Line for -K switch
 
-      Write_Line ("  -K        Give list of linker options specified " &
-                  "for link");
+      Write_Line
+        ("  -K        Give list of linker options specified for link");
 
       --  Line for -l switch
 
-      Write_Line ("  -l        Output chosen elaboration order");
+      Write_Line
+        ("  -l        Output chosen elaboration order");
 
       --  Line of -L switch
 
-      Write_Line ("  -Lxyz     Library build: adainit/final " &
-                  "renamed to xyzinit/final, implies -n");
+      Write_Line
+        ("  -Lxyz     Library build: adainit/final renamed to xyzinit/final, "
+         & "implies -n");
 
       --  Line for -m switch
 
-      Write_Line ("  -mnnn     Limit number of detected errors/warnings " &
-                  "to nnn (1-999999)");
+      Write_Line
+        ("  -mnnn     Limit number of detected errors/warnings to nnn "
+         & "(1-999999)");
 
       --  Line for -M switch
 
-      Write_Line ("  -Mxyz     Rename generated main program from " &
-                  "main to xyz");
+      Write_Line
+        ("  -Mxyz     Rename generated main program from main to xyz");
 
       --  Line for -n switch
 
-      Write_Line ("  -n        No Ada main program (foreign main routine)");
+      Write_Line
+        ("  -n        No Ada main program (foreign main routine)");
+
+      --  Line for -nognarl
+
+      Write_Line
+        ("  -nognarl  Don't use libgnarl when writing linker instructions");
 
       --  Line for -nostdinc
 
-      Write_Line ("  -nostdinc Don't look for source files " &
-                  "in the system default directory");
+      Write_Line
+        ("  -nostdinc Don't look for source files in the system default "
+         & "directory");
 
       --  Line for -nostdlib
 
-      Write_Line ("  -nostdlib Don't look for library files " &
-                  "in the system default directory");
+      Write_Line
+        ("  -nostdlib Don't look for library files in the system default "
+         & "directory");
 
       --  Line for -o switch
 
-      Write_Line ("  -o file   Give the output file name " &
-                  "(default is b~xxx.adb)");
+      Write_Line
+        ("  -o file   Give the output file name (default is b~xxx.adb)");
 
       --  Line for -O switch
 
-      Write_Line ("  -O        Give list of objects required for link");
+      Write_Line
+        ("  -O        Give list of objects required for link");
 
       --  Line for -p switch
 
-      Write_Line ("  -p        Pessimistic (worst-case) elaboration order");
+      Write_Line
+        ("  -p        Pessimistic (worst-case) elaboration order");
 
       --  Line for -P switch
 
-      Write_Line ("  -P        Generate binder file suitable for CodePeer");
+      Write_Line
+        ("  -P        Generate binder file suitable for CodePeer");
 
       --  Line for -r switch
 
-      Write_Line ("  -r        List restrictions that could be applied " &
-                  "to this partition");
+      Write_Line
+        ("  -r        List restrictions that could be applied to this "
+         & "partition");
 
       --  Line for -R switch
 
@@ -198,53 +228,59 @@ package body Bindusg is
 
       --  Line for -s switch
 
-      Write_Line ("  -s        Require all source files to be present");
+      Write_Line
+        ("  -s        Require all source files to be present");
 
       --  Line for -S?? switch
 
-      Write_Line ("  -S??      Sin/lo/hi/xx/ev Initialize_Scalars " &
-                  "invalid/low/high/hex/env var");
+      Write_Line
+        ("  -S??      Sin/lo/hi/xx/ev Initialize_Scalars "
+         & "invalid/low/high/hex/env var");
 
       --  Line for -static
 
-      Write_Line ("  -static   Link against a static GNAT run time");
+      Write_Line
+        ("  -static   Link against a static GNAT run time");
 
       --  Line for -shared
 
-      Write_Line ("  -shared   Link against a shared GNAT run time");
+      Write_Line
+        ("  -shared   Link against a shared GNAT run time");
 
       --  Line for -t switch
 
-      Write_Line ("  -t        Tolerate time stamp and other " &
-                  "consistency errors");
+      Write_Line
+        ("  -t        Tolerate time stamp and other consistency errors");
 
       --  Line for -T switch
 
-      Write_Line ("  -Tn       Set time slice value to n " &
-                  "milliseconds (n >= 0)");
+      Write_Line
+        ("  -Tn       Set time slice value to n milliseconds (n >= 0)");
 
       --  Line for -u switch
 
-      Write_Line ("  -un       Enable dynamic stack analysis, with " &
-                  "n results stored");
+      Write_Line
+        ("  -un       Enable dynamic stack analysis, with n results stored");
 
       --  Line for -v switch
 
-      Write_Line ("  -v        Verbose mode. Error messages, " &
-                  "header, summary output to stdout");
+      Write_Line
+        ("  -v        Verbose mode. Error messages, header, summary output to "
+         & "stdout");
 
       --  Line for -V switch
 
-      Write_Line ("  -Vkey=val Record bind-time variable key " &
-                  "with value val");
+      Write_Line
+        ("  -Vkey=val Record bind-time variable key with value val");
       --  Line for -w switch
 
-      Write_Line ("  -wx       Warning mode. (x=s/e for " &
-                  "suppress/treat as error)");
+      Write_Line
+        ("  -wx       Warning mode. (x=s/e for suppress/treat as error)");
 
       --  Line for -W switch
 
-      Write_Str  ("  -W?       Wide character encoding method (");
+      Write_Str
+        ("  -W?       Wide character encoding method (");
 
       for J in WC_Encoding_Method loop
          Write_Char (WC_Encoding_Letters (J));
@@ -260,36 +296,40 @@ package body Bindusg is
 
       --  Line for -x switch
 
-      Write_Line ("  -x        Exclude source files (check object " &
-                  "consistency only)");
+      Write_Line
+        ("  -x        Exclude source files (check object consistency only)");
 
       --  Line for -X switch
 
-      Write_Line ("  -Xnnn     Default exit status value = nnn");
+      Write_Line
+        ("  -Xnnn     Default exit status value = nnn");
 
       --  Line for -y switch
 
-      Write_Line ("  -y        Enable leap seconds");
+      Write_Line
+        ("  -y        Enable leap seconds");
 
       --  Line for -z switch
 
-      Write_Line ("  -z        No main subprogram (zero main)");
+      Write_Line
+        ("  -z        No main subprogram (zero main)");
 
       --  Line for --RTS
 
       --  Line for -Z switch
 
-      Write_Line ("  -Z        " &
-                  "Zero formatting in auxiliary outputs (-e, -K, -l, -R)");
+      Write_Line
+        ("  -Z        Zero formatting in auxiliary outputs (-e, -K, -l, -R)");
 
       --  Line for --RTS
 
-      Write_Line ("  --RTS=dir Specify the default source and " &
-                  "object search path");
+      Write_Line
+        ("  --RTS=dir Specify the default source and object search path");
 
       --  Line for sfile
 
-      Write_Line ("  lfile     Library file names");
+      Write_Line
+        ("  lfile     Library file names");
    end Display;
 
 end Bindusg;
index 9644633..8f52966 100644 (file)
@@ -6935,7 +6935,6 @@ package body Exp_Ch7 is
 
          Counter        : Int := 0;
          Finalizer_Data : Finalization_Exception_Data;
-         Num_Comps      : Nat := 0;
 
          function Process_Component_List_For_Finalize
            (Comps : Node_Id) return List_Id;
@@ -6951,25 +6950,28 @@ package body Exp_Ch7 is
            (Comps : Node_Id) return List_Id
          is
             procedure Process_Component_For_Finalize
-              (Decl  : Node_Id;
-               Alts  : List_Id;
-               Decls : List_Id;
-               Stmts : List_Id);
+              (Decl      : Node_Id;
+               Alts      : List_Id;
+               Decls     : List_Id;
+               Stmts     : List_Id;
+               Num_Comps : in out Nat);
             --  Process the declaration of a single controlled component. If
             --  flag Is_Local is enabled, create the corresponding label and
             --  jump circuitry. Alts is the list of case alternatives, Decls
             --  is the top level declaration list where labels are declared
-            --  and Stmts is the list of finalization actions.
+            --  and Stmts is the list of finalization actions. Num_Comps
+            --  denotes the current number of components needing finalization.
 
             ------------------------------------
             -- Process_Component_For_Finalize --
             ------------------------------------
 
             procedure Process_Component_For_Finalize
-              (Decl  : Node_Id;
-               Alts  : List_Id;
-               Decls : List_Id;
-               Stmts : List_Id)
+              (Decl      : Node_Id;
+               Alts      : List_Id;
+               Decls     : List_Id;
+               Stmts     : List_Id;
+               Num_Comps : in out Nat)
             is
                Id       : constant Entity_Id := Defining_Identifier (Decl);
                Typ      : constant Entity_Id := Etype (Id);
@@ -7075,6 +7077,7 @@ package body Exp_Ch7 is
             Jump_Block : Node_Id;
             Label      : Node_Id;
             Label_Id   : Entity_Id;
+            Num_Comps  : Nat;
             Stmts      : List_Id;
             Var_Case   : Node_Id;
 
@@ -7185,7 +7188,8 @@ package body Exp_Ch7 is
                     and then Has_Access_Constraint (Decl_Id)
                     and then No (Expression (Decl))
                   then
-                     Process_Component_For_Finalize (Decl, Alts, Decls, Stmts);
+                     Process_Component_For_Finalize
+                       (Decl, Alts, Decls, Stmts, Num_Comps);
                   end if;
 
                   Prev_Non_Pragma (Decl);
@@ -7212,7 +7216,8 @@ package body Exp_Ch7 is
                   then
                      null;
                   else
-                     Process_Component_For_Finalize (Decl, Alts, Decls, Stmts);
+                     Process_Component_For_Finalize
+                       (Decl, Alts, Decls, Stmts, Num_Comps);
                   end if;
                end if;
 
index ebe87c1..ed1138d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2017, 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- --
@@ -447,6 +447,9 @@ procedure Gnatbind is
          elsif Argv (2 .. Argv'Last) = "nostdinc" then
             Opt.No_Stdinc := True;
 
+         elsif Argv (2 .. Argv'Last) = "nognarl" then
+            Opt.No_Libgnarl := True;
+
          --  -static
 
          elsif Argv (2 .. Argv'Last) = "static" then
index 94be519..09ed571 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2017, 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- --
@@ -1147,6 +1147,10 @@ package Opt is
    --  GNATMAKE, GNATBIND, GNATFIND, GNATXREF
    --  Set to True if no default library search dirs added to search list.
 
+   No_Libgnarl : Boolean := False;
+   --  GNATBIND
+   --  Set to True if libgnarl is not available in the runtime.
+
    No_Strict_Aliasing : Boolean := False;
    --  GNAT
    --  Set True if pragma No_Strict_Aliasing with no parameters encountered.