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 incorrectly allows overriding_indicators to be applied to protected subprogram bodies (and flags a style error with -gnatyO when they're missing), but those are disallowed by the Ada RM (see RM-8.3.1(3-6) and AC95-00213 for confirmation of intent). This is fixed, but the error can be changed to a warning with -gnatd.E to ease transition for programs that were using such overriding_indicators. The test below must report the following style warning and error when compiled with: $ gcc -c -gnatyO -gnatj60 prot_subp_indicator_bug.adb prot_subp_indicator_bug.adb:17:07: (style) missing "overriding" indicator in declaration of "P" prot_subp_indicator_bug.adb:32:07: overriding indicator not allowed for protected subprogram body and the following warnings when compiled with: $ gcc -c -gnatyO -gnatd.E -gnatj60 prot_subp_indicator_bug.adb prot_subp_indicator_bug.adb:17:07: (style) missing "overriding" indicator in declaration of "P" prot_subp_indicator_bug.adb:32:07: warning: overriding indicator not allowed for protected subprogram body procedure Prot_Subp_Indicator_Bug is package Synch_Pkg is type Synch_Interface is synchronized interface; procedure P (X : out Synch_Interface) is abstract; procedure Q (X : in out Synch_Interface) is abstract; end Synch_Pkg; use Synch_Pkg; protected type Prot_Type is new Synch_Interface with procedure P; -- Warning "missing overriding indicator" OK with -gnatyO overriding -- OK procedure Q; end Prot_Type; protected body Prot_Type is procedure P is -- Shouldn't get warning about adding overriding indicator begin null; end P; overriding -- Illegal (but only give a warning when using -gnatd.E) procedure Q is begin null; end Q; end Prot_Type; begin null; end Prot_Subp_Indicator_Bug; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-05-21 Gary Dismukes <dismukes@adacore.com> * debug.adb: Add case of illegal overriding_indicator for a protected subprogram body to description of -gnatd.E switch. * sem_ch6.adb (Verify_Overriding_Indicator): Issue error message for cases of giving overriding_indicators on protected subprogram bodies, but change this to a warning if -gnatd.E is enabled. No longer give a style warning about missing indicators on protected subprogram bodies.
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] |