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] |
This patch implements the required incompatible change in Ada 2012 that makes overlap of elementary parameters passed as OUT or IN OUT an error (rather than a warning situation). It also implements the debug flag -gnatd.E that converts this back to a warning. The following program compiled in Ada 2012 mode gives: 1. with Text_IO; use Text_IO; 2. procedure OverlapWarn is 3. procedure OW (a, b : out Integer) is 4. begin 5. A := 3; 6. B := 3; 7. end; 8. X : Integer; 9. begin 10. OW (X, X); | >>> writable actual for "a" overlaps with actual for "b" 11. Put_Line (X'Img); 12. end OverlapWarn; But if -gnatd.E is given in Ada 2012 mode, the error is a warning: 1. with Text_IO; use Text_IO; 2. procedure OverlapWarn is 3. procedure OW (a, b : out Integer) is 4. begin 5. A := 3; 6. B := 3; 7. end; 8. X : Integer; 9. begin 10. OW (X, X); | >>> warning: writable actual for "a" overlaps with actual for "b" 11. Put_Line (X'Img); 12. end OverlapWarn; And the program can be executed, and outputs 3 Tested on x86_64-pc-linux-gnu, committed on trunk 2013-10-14 Robert Dewar <dewar@adacore.com> * debug.adb: Document -gnatd.E. * gnat1drv.adb (Adjust_Global_Switches): Set Error_To_Warning if -gnatd.E set. * opt.ads (Error_To_Warning): New switch. * osint.adb: Minor reformatting. * sem_warn.adb (Warn_On_Overlapping_Actuals): Overlap is error in some cases in Ada 2012 mode (unless Error_To_Warning) is set. * sem_warn.ads (Warn_On_Overlapping_Actuals): Document error in Ada 2012 mode.
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] |