Patchwork [Ada] New switch --unchecked-shared-lib-imports

login
register
mail settings
Submitter Arnaud Charlet
Date June 22, 2010, 1:47 p.m.
Message ID <20100622134711.GA18515@adacore.com>
Download mbox | patch
Permalink /patch/56497/
State New
Headers show

Comments

Arnaud Charlet - June 22, 2010, 1:47 p.m.
A new switch --unchecked-shared-lib-imports is added to gnatmake and
gnatclean. When this switch is specified on the command line, shared
library projects are allowed to import static library projects.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-06-22  Vincent Celier  <celier@adacore.com>

	* clean.adb (Parse_Cmd_Line): Recognize switch
	--unchecked-shared-lib-imports.
	(Usage): Add line for switch --unchecked-shared-lib-imports
	* makeusg.adb: Add line for switch --unchecked-shared-lib-imports
	* makeutl.ads: (Unchecked_Shared_Lib_Imports): New constant string
	moved from GPR_Util.
	* switch-m.adb (Scan_Make_Switches): Recognize switch
	--unchecked-shared-lib-imports.
	* vms_data.ads: Add VMS qualifiers /UNCHECKED_SHARED_LIB_IMPORTS.
	* gnat_ugn.texi: Add documentation for new switch
	--unchecked-shared-lib-imports.  Add also documentation for --subdirs.

Patch

Index: clean.adb
===================================================================
--- clean.adb	(revision 161073)
+++ clean.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-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- --
@@ -1677,6 +1677,9 @@  package body Clean is
                              new String'
                                (Arg (Subdirs_Option'Length + 1 .. Arg'Last));
 
+                        elsif Arg = Makeutl.Unchecked_Shared_Lib_Imports then
+                           Opt.Unchecked_Shared_Lib_Imports := True;
+
                         else
                            Bad_Argument;
                         end if;
@@ -1957,6 +1960,8 @@  package body Clean is
          New_Line;
 
          Put_Line ("  --subdirs=dir real obj/lib/exec dirs are subdirs");
+         Put_Line ("  " & Makeutl.Unchecked_Shared_Lib_Imports);
+         Put_Line ("       Allow shared libraries to import static libraries");
          New_Line;
 
          Put_Line ("  -c       Only delete compiler generated files");
Index: gnat_ugn.texi
===================================================================
--- gnat_ugn.texi	(revision 161158)
+++ gnat_ugn.texi	(working copy)
@@ -9193,6 +9193,15 @@  itself must not include any embedded spa
 
 @end ifclear
 
+@item ^--subdirs^/SUBDIRS^=subdir
+Actual object directory of each project file is the subdirectory subdir of the
+object directory specified or defauted in the project file.
+
+@item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^
+By default, shared library projects are not allowed to import static library
+projects. When this switch is used on the command line, this restriction is
+relaxed.
+
 @item ^-a^/ALL_FILES^
 @cindex @option{^-a^/ALL_FILES^} (@command{gnatmake})
 Consider all files in the make process, even the GNAT internal system
@@ -15329,6 +15338,15 @@  Display Copyright and version, then exit
 If @option{--version} was not used, display usage, then exit disregarding
 all other options.
 
+@item ^--subdirs^/SUBDIRS^=subdir
+Actual object directory of each project file is the subdirectory subdir of the
+object directory specified or defauted in the project file.
+
+@item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^
+By default, shared library projects are not allowed to import static library
+projects. When this switch is used on the command line, this restriction is
+relaxed.
+
 @item ^-c^/COMPILER_FILES_ONLY^
 @cindex @option{^-c^/COMPILER_FILES_ONLY^} (@code{gnatclean})
 Only attempt to delete the files produced by the compiler, not those produced
Index: makeusg.adb
===================================================================
--- makeusg.adb	(revision 161073)
+++ makeusg.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2008, 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- --
@@ -23,6 +23,7 @@ 
 --                                                                          --
 ------------------------------------------------------------------------------
 
+with Makeutl;
 with Osint;  use Osint;
 with Output; use Output;
 with Usage;
@@ -311,6 +312,14 @@  begin
 
    Write_Str ("  --subdirs=dir real obj/lib/exec dirs are subdirs");
    Write_Eol;
+
+   --  Line for --unchecked-shared-lib-imports
+
+   Write_Str ("  ");
+   Write_Str (Makeutl.Unchecked_Shared_Lib_Imports);
+   Write_Eol;
+   Write_Str ("            Allow shared libraries to import static libraries");
+   Write_Eol;
    Write_Eol;
 
    --  General Compiler, Binder, Linker switches
Index: makeutl.ads
===================================================================
--- makeutl.ads	(revision 161073)
+++ makeutl.ads	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2004-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-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- --
@@ -47,6 +47,11 @@  package Makeutl is
    --  Switch used to indicate that the real directories (object, exec,
    --  library, ...) are subdirectories of those in the project file.
 
+   Unchecked_Shared_Lib_Imports : constant String :=
+                                    "--unchecked-shared-lib-imports";
+   --  Command line switch to allow shared library projects to import projects
+   --  that are not shared library projects.
+
    procedure Add
      (Option : String_Access;
       To     : in out String_List_Access;
Index: switch-m.adb
===================================================================
--- switch-m.adb	(revision 161073)
+++ switch-m.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-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- --
@@ -584,6 +584,9 @@  package body Switch.M is
                   (Switch_Chars'First + Subdirs_Option'Length ..
                    Switch_Chars'Last));
 
+         elsif Switch_Chars = Makeutl.Unchecked_Shared_Lib_Imports then
+            Opt.Unchecked_Shared_Lib_Imports := True;
+
          elsif Switch_Chars (Ptr) = '-' then
             Bad_Switch (Switch_Chars);
 
Index: vms_data.ads
===================================================================
--- vms_data.ads	(revision 161153)
+++ vms_data.ads	(working copy)
@@ -1154,6 +1154,14 @@  package VMS_Data is
    --   of the directory specified in the project file. If the subdirectory
    --   does not exist, it is created automatically.
 
+   S_Clean_Unc_Shared_Libs : aliased constant S :=
+                                          "/UNCHECKED_SHARED_LIB_IMPORTS " &
+                                              "--unchecked-shared-lib-imports";
+   --        /NOUNCHECKED_SHARED_LIB_IMPORTS (D)
+   --        /UNCHECKED_SHARED_LIB_IMPORTS
+   --
+   --   Allow shared library projects to import static library projects
+
    S_Clean_Verbose : aliased constant S := "/VERBOSE "                     &
                                             "-v";
    --        /NOVERBOSE (D)
@@ -1179,7 +1187,8 @@  package VMS_Data is
                        S_Clean_Recurs 'Access,
                        S_Clean_Search 'Access,
                        S_Clean_Subdirs'Access,
-                       S_Clean_Verbose'Access);
+                       S_Clean_Verbose'Access,
+                       S_Clean_Unc_Shared_Libs'Access);
 
    -------------------------------
    -- Switches for GNAT COMPILE --
@@ -4860,6 +4869,14 @@  package VMS_Data is
    --   For example, -O -O2 is different than -O2 -O, but -g -O is equivalent
    --   to -O -g.
 
+   S_Make_Unc_Shared_Libs : aliased constant S :=
+                                          "/UNCHECKED_SHARED_LIB_IMPORTS " &
+                                              "--unchecked-shared-lib-imports";
+   --        /NOUNCHECKED_SHARED_LIB_IMPORTS (D)
+   --        /UNCHECKED_SHARED_LIB_IMPORTS
+   --
+   --   Allow shared library projects to import static library projects
+
    S_Make_Unique  : aliased constant S := "/UNIQUE "                       &
                                             "-u";
    --        /NOUNIQUE (D)
@@ -4937,6 +4954,7 @@  package VMS_Data is
                       S_Make_Stand   'Access,
                       S_Make_Subdirs 'Access,
                       S_Make_Switch  'Access,
+                      S_Make_Unc_Shared_Libs'Access,
                       S_Make_Unique  'Access,
                       S_Make_Use_Map 'Access,
                       S_Make_Verbose 'Access);