This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Spurious warning on generated with_clause for renamed unit

This patch suppresses spurious warnings that may be generated when the prefix
of a with_clause for a child unit denotes the renaming of a parent unit.
Such renamings generate internal with_clauses that are not marked Implicit_With
because they must be properly installed as part of the context, but they are
never redundant with explicit with_clauses.

The following must compile quietly:

   gcc -c -gnatwa pkg_b2.adb

with Renamed_Pkg_A;
package Pkg_B2
   procedure Proc_1( Val_1 : in out Renamed_Pkg_A.Type_A );
end Pkg_B2;
package Pkg_A
   type Type_A is ( A1, A2 );
end Pkg_A;
with Pkg_A;
package Renamed_Pkg_A renames Pkg_A;
package Pkg_A.Child_A
   type Type_B is ( B1, B2 );
end Pkg_A.Child_A;
with Renamed_Pkg_A.Child_A;
package body Pkg_B2
   use type Renamed_Pkg_A.Child_A.Type_B;

   Val_B : Renamed_Pkg_A.Child_A.Type_B := Renamed_Pkg_A.Child_A.Type_B'First;
   procedure Proc_1( Val_1 : in out Renamed_Pkg_A.Type_A )
      if Val_B = Renamed_Pkg_A.Child_A.Type_B'First then
         Val_1 := Renamed_Pkg_A.Type_A'Last;
         Val_B := Renamed_Pkg_A.Child_A.Type_B'Last;
         Val_B := Renamed_Pkg_A.Child_A.Type_B'First;
      end if;
   end Proc_1;
end Pkg_B2;

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

2014-08-01  Ed Schonberg  <>

	* sem_ch10.adb (Analyze_Compilation_Unit): Do not place a
	warning on a with_clause created for the renaming of a parent
	unit in an explicit with_clause.

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]