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] |
A new pragma Compiler_Unit_Warning replaces the old pragma Compiler_Unit (which is retained as synonymous so that new compilers can be used to bootstrap old sources). The new pragma differs from the old one in two respects First: the set of things checked for is changed, RAISE WITH is now allowed, but several new Ada 2012 features are flagged. Second: the message is a warning, not an error The reason we made a new pragma here is to deal with bootstrap issues. We wanted to allow RAISE WITH, and are willing to say we require GCC 4.1 for bootstrapping. But just removing the calls to Check_Compiler_Unit for RAISE WITH wouldn't work. That's because older compilers, even though they support RAISE WITH fine, don't think this should be allowed in units with pragma Compiler_Unit. By changing to a new pragma, older compilers will issue a warning of unrecognized pragmas in the first build phase, but warnings are ignored then, and then subsequent phases of the build will use the latest version of the compiler (and thus the latest set of choices wrt pragma Compiler_Unit_Warning). The following test program is compiled with -gnatld7 1. pragma Compiler_Unit_Warning; 2. 3. procedure CUWarn (X : in out Integer) is 4. A : Integer; 5. begin 6. if X > 3 then 7. A := (if X > 4 then 2 else 1); | >>> warning: use of construct not allowed in compiler 8. end if; 9. 10. if X in 1 | 2 | 5 then | >>> warning: use of construct not allowed in compiler 11. X := 52; 12. end if; 13. 14. raise Constraint_Error with "always raised"; 15. end; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-02-25 Robert Dewar <dewar@adacore.com> * s-excdeb.ads, s-except.ads, s-exctab.adb, s-exctab.ads, s-finmas.ads, s-htable.adb, s-htable.ads, s-imenne.adb, s-imenne.ads, s-imgenu.adb, s-imgenu.ads, s-mastop.adb, s-mastop.ads, s-memory-vms_64.adb, s-memory-vms_64.ads, s-memory.adb, s-memory.ads, s-os_lib.adb, s-os_lib.ads, s-parame.adb, s-parame.ads, s-purexc.ads, s-restri.adb, s-restri.ads, s-rident.ads, s-secsta.adb, s-secsta.ads, s-soflin.adb, s-soflin.ads, s-sopco3.adb, s-sopco3.ads, s-sopco4.adb, s-sopco4.ads, s-sopco5.adb, s-sopco5.ads, s-spsufi.ads, s-stache.adb, s-stache.ads, s-stalib.adb, s-stalib.ads, s-stoele.adb, s-stoele.ads, s-strcom.adb, s-strcom.ads, s-strhas.adb, s-string.adb, s-string.ads, s-strops.adb, s-strops.ads, s-ststop.adb, s-ststop.ads, s-traceb.adb, s-traceb.ads, s-traent.adb, s-traent.ads, s-unstyp.ads, s-utf_32.adb, s-utf_32.ads, s-wchcnv.adb, s-wchcnv.ads, s-wchcon.adb, s-wchcon.ads, s-wchjis.adb, s-wchjis.ads, sem_ch11.adb, sem_ch4.adb, sem_ch5.adb, sem_prag.adb, snames.ads-tmpl: Change Compiler_Unit everywhere to Compiler_Unit_Warning.
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] |