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] |
The compiler was prohibiting overriding indicators on the bodies of protected subprograms. The parser was corrected to allow these. There were also problems fixed in the semantic checking for use of "not overriding", which was requiring subprograms to be primitive, whereas this form of overrriding indicator is also allowed on protected subprograms (which are not defined to be primitive operations). Additionally, when the style check -gnatyO was enabled, the compiler failed to warn about the missing overriding indicator on declarations of protected subprograms that implement an inherited operation, and this is also corrected. The test included below must produce the following error output when compiled with: gcc -c -gnat05 -gnatyO protected_overriding.adb protected_overriding.ads:15:07: (style) missing "overriding" indicator in declaration of "Proc_2" protected_overriding.ads:17:22: subprogram "Proc_3" overrides inherited operation at line 9 package Protected_Overriding is type I is limited interface; procedure Proc_1 (V : in out I) is abstract; procedure Proc_2 (V : in out I) is abstract; procedure Proc_3 (V : in out I) is abstract; protected PT is new I with overriding procedure Proc_1; -- OK procedure Proc_2; -- ERROR (missing overriding) not overriding procedure Proc_3; -- ERROR (must be overriding) not overriding procedure Extra; -- OK not overriding function "not" (I : Integer) return Boolean; -- OK end PT; end Protected_Overriding; package body Protected_Overriding is protected body PT is overriding procedure Proc_1 is begin null; end Proc_1; overriding procedure Proc_2 is begin null; end Proc_2; procedure Proc_3 is begin null; end Proc_3; not overriding procedure Extra is begin null; end Extra; not overriding function "not" (I : Integer) return Boolean is begin return False; end "not"; end PT; end Protected_Overriding; Tested on x86_64-pc-linux-gnu, committed on trunk 2009-04-17 Gary Dismukes <dismukes@adacore.com> * par-ch6.adb (P_Subprogram): Overriding indicators should be allowed on protected subprogram bodies, so exclude the case where Pf_Flags is Pf_Decl_Pbod from the error check. * par-ch9.adb (P_Protected_Operation_Items): Permit overriding indicators on subprograms in protected bodies, and proceed with parsing the subprogram. * sem_ch6.adb (Verify_Overriding_Indicator): Exclude protected subprograms from the check for primitiveness on subprograms with overriding indicators. (Check_Overriding_Indicator): Include protected subprograms in the style check for missing overriding indicators.
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] |