The patch implements the No_Task_Parts aspect, which says that a type and extensions of it cannot contain tasks.
In addition, we optimize away tasking-related code for T'Class when T has No_Task_Parts. This is mostly just an efficiency improvement, but it fixes a bug in one obscure case: The expanded code for a "for ... of" loop contains an object of a class-wide type (e.g. Reversible_Iterator'Class), so the compiler would normally generate tasking-related calls, which are blocking, so if the procedure containing "for ... of" is called from a protected object, and Detect_Blocking is enabled, Program_Error will be raised. These compiler changes, along with adding No_Task_Parts to the iterator interfaces, fixes that bug. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * aspects.ads (No_Task_Parts): New aspect. * snames.ads-tmpl: Add the aspect name. * exp_ch6.adb (Might_Have_Tasks): Return False if this is a class-wide type whose specific type has No_Task_Parts. * freeze.adb (Check_No_Parts_Violations): This is an adaptation of the procedure formerly known as Check_No_Controlled_Parts_Violations, which now supports both No_Controlled_Parts and No_Task_Parts. It takes a parameter indicating which aspect is being checked. (Freeze_Entity): Call Check_No_Parts_Violations for both aspects. * sem_ch13.adb (Analyze_Aspect_Specifications): The code for Aspect_No_Controlled_Parts already works as is with Aspect_No_Task_Parts. * libgnat/a-iteint.ads: Add No_Task_Parts aspect to the two iterator iterfaces. * doc/gnat_rm/implementation_defined_aspects.rst: Add documentation for the No_Task_Parts aspect. * gnat_rm.texi: Regenerate.
patch.diff.gz
Description: application/gzip