freeze.adb (Freeze_Profile): Suppress warning if imported subprogram is not at librar...
authorBob Duff <duff@adacore.com>
Fri, 22 May 2015 12:31:03 +0000 (12:31 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 22 May 2015 12:31:03 +0000 (14:31 +0200)
2015-05-22  Bob Duff  <duff@adacore.com>

* freeze.adb (Freeze_Profile): Suppress warning if imported
subprogram is not at library level.

From-SVN: r223549

gcc/ada/ChangeLog
gcc/ada/freeze.adb

index 161d0cf4c963ae87acafb056183ca6cca4b34798..b803fcd79902b9e22c0adf5425387733a3d1733d 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-22  Bob Duff  <duff@adacore.com>
+
+       * freeze.adb (Freeze_Profile): Suppress warning if imported
+       subprogram is not at library level.
+
 2015-05-22  Robert Dewar  <dewar@adacore.com>
 
        * sem_ch8.adb (Analyze_Object_Renaming): Check for renaming
index f32498127117cc1de4586b7ac2c3c2ef760e9e73..1c4615bbba2a2e46f9126cc960e896a27235f907 100644 (file)
@@ -3357,9 +3357,20 @@ package body Freeze is
             end if;
          end if;
 
-         --  Check suspicious use of Import in pure unit
+         --  Check suspicious use of Import in pure unit (cases where the RM
+         --  allows calls to be omitted).
 
-         if Is_Imported (E) and then Is_Pure (Cunit_Entity (Current_Sem_Unit))
+         if Is_Imported (E)
+
+           --  It might be suspicious if the compilation unit has the Pure
+           --  aspect/pragma.
+
+           and then Has_Pragma_Pure (Cunit_Entity (Current_Sem_Unit))
+
+           --  The RM allows omission of calls only in the case of
+           --  library-level subprograms (see RM-10.2.1(18)).
+
+           and then Is_Library_Level_Entity (E)
 
            --  Ignore internally generated entity. This happens in some cases
            --  of subprograms in specs, where we generate an implied body.