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] Illegal external aspects not detected


This patch modifies the categorization of aspects Async_Readers, Async_Writers,
Effective_Reads and Effective_Writes to no longer require delayed actions. This
in turn ensures that the analysis of their aspect form correctly creates their
pragma counterparts.

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

--  illegal_externals.ads

package Illegal_Externals with SPARK_Mode => On is
   type I  is range 1 .. 10 with Async_Readers;
   type I2 is range 1 .. 10 with Async_Readers => True; 
   type I3 is range 1 .. 10 with Async_Readers => False; 
   type T1 is array (I) of Integer with Volatile; 
   type T2 is array (I) of Integer
     with Volatile,
          Async_Readers    => True, 
          Async_Writers    => False,
          Effective_Writes => False,
          Effective_Reads  => False;
   subtype S1 is Integer range 1 .. 10 with Async_Readers; 
   subtype S2 is Integer range 1 .. 10 with Async_Readers => True; 
   subtype S3 is Integer range 1 .. 10 with Async_Readers => False; 
   procedure P1 
     with Import,
          Convention => C;
   procedure P2
     with Import,
          Async_Readers, 
          Convention => C;
end Illegal_Externals;

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

$ gcc -c illegal_externals.ads
illegal_externals.ads:2:34: aspect "Async_Readers" must apply to a volatile
  object
illegal_externals.ads:3:34: aspect "Async_Readers" must apply to a volatile
  object
illegal_externals.ads:4:34: aspect "Async_Readers" must apply to a volatile
  object
illegal_externals.ads:8:11: aspect "Async_Readers" must apply to a volatile
  object
illegal_externals.ads:9:11: aspect "Async_Writers" must apply to a volatile
  object
illegal_externals.ads:10:11: aspect "Effective_Writes" must apply to a volatile
  object
illegal_externals.ads:11:11: aspect "Effective_Reads" must apply to a volatile
  object
illegal_externals.ads:12:45: aspect "Async_Readers" must apply to a volatile
  object
illegal_externals.ads:13:45: aspect "Async_Readers" must apply to a volatile
  object
illegal_externals.ads:14:45: aspect "Async_Readers" must apply to a volatile
  object
illegal_externals.ads:20:11: aspect "Async_Readers" must apply to a volatile
  object

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

2014-07-30  Hristian Kirtchev  <kirtchev@adacore.com>

	* aspects.ads Aspects Async_Readers, Async_Writers,
	Effective_Reads and Effective_Writes do not need to be delayed.
	* sem_ch13.adb (Analyze_Aspect_Specifications): Propagate the
	optional Boolean expression when generating the corresponding
	pragma for an external property aspect.
	* sem_prag.adb (Analyze_External_Property_In_Decl_Part): Remove
	local constant Obj. Add local constant Obj_Id. Reimplement the
	check which ensures that the related variable is in fact volatile.
	(Analyze_Pragma): Reimplement the analysis of external property pragmas.
	* sem_util.adb (Is_Enabled): New routine.
	(Variable_Has_Enabled_Property): Reimplement the detection of
	an enabled external property.

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]