This is the mail archive of the gcc-patches@gcc.gnu.org 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] Local renaming should not be externally visible


This patch modifies the analysis of a package body to hide object and
subprogram renamings from external visibility.

------------
-- Source --
------------

--  externals.ads

package Externals is
   procedure Force_Body;
end Externals;

--  externals.adb

package body Externals is
   Obj : constant String := "Hello";
   Obj_Ren : String renames Obj;

   procedure Force_Body is begin null; end Force_Body;
end Externals;

--  main.adb

with Externals;

procedure Main is
begin
   Externals.Force_Body;
end Main;

----------------------------
-- Compilation and output --
----------------------------

$ gnatmake -q main.adb
$ nm main | grep "externals__obj" | cut -d' ' -f2-
r externals__obj
r externals__obj_ren

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

2014-10-23  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch7.adb (Analyze_Package_Body_Helper):
	The logic which hides local entities from external
	visibility is now contained in routine Hide_Public_Entities.
	(Hide_Public_Entities): New routine. Object and subprogram
	renamings are now hidden from external visibility the same way
	objects are.

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]