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] Warning on potentially blocking operation.


GNAT warns when a potentially blocking statement appears within a protected
operation, as specified in 9.5.1.  The operation Abort_Task, in package
Ada.Task_Identification )C.7.1 (16)) is also potentially blocking. The warming
was not generated for it.

Compiling the following must yield:

   test_term.adb:23:10:
       warning: potentially blocking operation in protected operation
   test_term.adb:24:10:
       warning: potentially blocking operation in protected operation


with Ada.Task_Identification; use Ada.Task_Identification;
procedure Test_Term is

   task type Tsk is
      entry E1;
   end;

   protected Reaper is
      entry Finis;
   end Reaper;

   task body Tsk is
   begin
      accept E1;
   end;

   Tsk1 : Tsk;
   Tsk2 : Tsk;

   protected body Reaper is
      entry Finis when true is
      begin
         abort Tsk1;                    --  warning : potentially blocking
         abort_task (Tsk2'identity);    --  warning : potentially blocking
     end Finis;
   end Reaper;

begin
   Tsk1.E1;
   Tsk2.E1;
   Reaper.Finis;
end;

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

2008-08-05  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb (Resolve_Call): If this is a call to the predefined
	Abort_Task, warn if the call appears within a protected operation.

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]