[Ada] gnatbind: ghost code with -gnatQ
authorBob Duff <duff@adacore.com>
Tue, 11 Dec 2018 11:11:26 +0000 (11:11 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 11 Dec 2018 11:11:26 +0000 (11:11 +0000)
This patch fixes a bug where if a library unit is compiled with -gnatQ,
and that library unit is an ignored Ghost unit, then gnatbind silently
fails.

2018-12-11  Bob Duff  <duff@adacore.com>

gcc/ada/

* gnat1drv.adb (gnat1drv): Pass the correct Object value when
calling Write_ALI in the case of -gnatQ.
* gnatbind.adb (Gnatbind): Avoid silent failure; give an error
message.

From-SVN: r267004

gcc/ada/ChangeLog
gcc/ada/gnat1drv.adb
gcc/ada/gnatbind.adb

index 33d2a1499d4ac1dc4c52ee76143be2288b70c2a9..b70184fc15836c2deddcd9654502ba2ef022cdd5 100644 (file)
@@ -1,3 +1,10 @@
+2018-12-11  Bob Duff  <duff@adacore.com>
+
+       * gnat1drv.adb (gnat1drv): Pass the correct Object value when
+       calling Write_ALI in the case of -gnatQ.
+       * gnatbind.adb (Gnatbind): Avoid silent failure; give an error
+       message.
+
 2018-12-11  Ed Schonberg  <schonberg@adacore.com>
 
        * exp_unst.adb (Needs_Fat_Pointer): A fat pointer is required if
index 9f428148266386810458893a912a2f4298bdb12b..bfc3b04a6057a926d8dcedfbe810cf76d8cea237 100644 (file)
@@ -1452,10 +1452,11 @@ begin
          Tree_Gen;
 
          --  Generate ALI file if specially requested, or for missing subunits,
-         --  subunits or predefined generic.
+         --  subunits or predefined generic. For ignored ghost code, the object
+         --  file IS generated, so Object should be True.
 
          if Opt.Force_ALI_Tree_File then
-            Write_ALI (Object => False);
+            Write_ALI (Object => Is_Ignored_Ghost_Unit (Main_Unit_Node));
          end if;
 
          Namet.Finalize;
index 5ab1bf1005ff45d3c4c51a029d747a38ee62e1ae..7d42b6bf8f77d813aa4e54e3f3d5c7464c1fc1eb 100644 (file)
@@ -790,6 +790,7 @@ begin
       --  Quit if some file needs compiling
 
       if No_Object_Specified then
+         Error_Msg ("no object specified");
          raise Unrecoverable_Error;
       end if;