From 8ed7930e45b8232ed637f207fc48222112742a51 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 2 Jan 2013 11:38:18 +0100 Subject: [PATCH] [multiple changes] 2013-01-02 Hristian Kirtchev * sem_attr.adb (Analyze_Attribute): Skip the special _Parent scope generated for subprogram inlining purposes while trying to locate the enclosing function. * sem_prag.adb (Analyze_Pragma): Preanalyze the boolean expression of pragma Postcondition when the pragma comes from source and appears inside a subprogram body. 2013-01-02 Thomas Quinot * switch-c.adb, fe.h, back_end.adb: Enable generation of instantiation information in debug info unconditionally when using -fdump-scos, instead of relying on a separate command line switch -fdebug-instances. 2013-01-02 Ed Schonberg * sem_ch12.adb: Additional refinement of predicate. 2013-01-02 Vincent Celier * vms_data.ads: Remove incorrect spaces at end of descriptions of qualifiers for single switch. 2013-01-02 Ben Brosgol * gnat_rm.texi: Minor edits / wordsmithing in section on pragma Check_Float_Overflow. 2013-01-02 Thomas Quinot * sprint.adb (Sprint_Node_Actual): Do not add extra parens for a conditional expression (CASE or IF expression) that already has parens. Also omit ELSE keyword for an IF expression without an ELSE part. 2013-01-02 Thomas Quinot * gnat1drv.adb (Adjust_Global_Switches): Adjust back-end flag_debug_instances here, after front-end switches have been processed. From-SVN: r194792 --- gcc/ada/ChangeLog | 45 +++++++++++ gcc/ada/back_end.adb | 5 -- gcc/ada/fe.h | 8 +- gcc/ada/gcc-interface/Make-lang.in | 124 +++++++++++++++-------------- gcc/ada/gcc-interface/gigi.h | 2 + gcc/ada/gcc-interface/misc.c | 21 ++++- gcc/ada/gnat1drv.adb | 7 ++ gcc/ada/gnat_rm.texi | 42 +++++----- gcc/ada/sem_attr.adb | 21 ++++- gcc/ada/sem_ch12.adb | 5 +- gcc/ada/sem_prag.adb | 17 +++- gcc/ada/sprint.adb | 38 ++++++--- gcc/ada/switch-c.adb | 1 + gcc/ada/vms_data.ads | 6 +- 14 files changed, 230 insertions(+), 112 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 10b2b5a4725..17ddd2692fd 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,48 @@ +2013-01-02 Hristian Kirtchev + + * sem_attr.adb (Analyze_Attribute): Skip the special _Parent + scope generated for subprogram inlining purposes while trying + to locate the enclosing function. + * sem_prag.adb (Analyze_Pragma): Preanalyze the boolean + expression of pragma Postcondition when the pragma comes from + source and appears inside a subprogram body. + +2013-01-02 Thomas Quinot + + * switch-c.adb, fe.h, back_end.adb: Enable generation of instantiation + information in debug info unconditionally when using -fdump-scos, + instead of relying on a separate command line switch -fdebug-instances. + * gcc-interface/gigi.h, gcc-interface/misc.c + (set_flag_debug_instances): New subprogram. + * gcc-interface/Make-lang.in: Update dependencies. + +2013-01-02 Ed Schonberg + + * sem_ch12.adb: Additional refinement of predicate. + +2013-01-02 Vincent Celier + + * vms_data.ads: Remove incorrect spaces at end of descriptions + of qualifiers for single switch. + +2013-01-02 Ben Brosgol + + * gnat_rm.texi: Minor edits / wordsmithing in section on pragma + Check_Float_Overflow. + +2013-01-02 Thomas Quinot + + * sprint.adb (Sprint_Node_Actual): Do not add extra parens for + a conditional expression (CASE or IF expression) that already + has parens. Also omit ELSE keyword for an IF expression without + an ELSE part. + +2013-01-02 Thomas Quinot + + * gnat1drv.adb (Adjust_Global_Switches): Adjust back-end + flag_debug_instances here, after front-end switches have been + processed. + 2013-01-02 Vincent Celier * usage.adb: Minor reformatting. diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index aa398ff31c3..f23230ecf9d 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -244,11 +244,6 @@ package body Back_End is elsif Switch_Chars (First .. Last) = "fdump-scos" then Opt.Generate_SCO := True; - - -- Back end switch -fdebug-instances also enables instance table - -- SCO generation. - - elsif Switch_Chars (First .. Last) = "fdebug-instances" then Opt.Generate_SCO_Instance_Table := True; end if; diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index fe52233202b..6c752e899b3 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -178,19 +178,19 @@ extern Boolean In_Same_Source_Unit (Node_Id, Node_Id); /* opt: */ -#define Global_Discard_Names opt__global_discard_names +#define Back_Annotate_Rep_Info opt__back_annotate_rep_info #define Exception_Extra_Info opt__exception_extra_info #define Exception_Locations_Suppressed opt__exception_locations_suppressed #define Exception_Mechanism opt__exception_mechanism -#define Back_Annotate_Rep_Info opt__back_annotate_rep_info +#define Global_Discard_Names opt__global_discard_names typedef enum {Setjmp_Longjmp, Back_End_Exceptions} Exception_Mechanism_Type; -extern Boolean Global_Discard_Names; +extern Boolean Back_Annotate_Rep_Info; extern Boolean Exception_Extra_Info; extern Boolean Exception_Locations_Suppressed; extern Exception_Mechanism_Type Exception_Mechanism; -extern Boolean Back_Annotate_Rep_Info; +extern Boolean Global_Discard_Names; /* restrict: */ diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index 0d83ab88208..0e0cd6d266f 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -2194,14 +2194,13 @@ ada/exp_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/expander.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ ada/atree.adb ada/casing.ads ada/debug.ads ada/debug_a.ads \ - ada/debug_a.adb ada/einfo.ads ada/elists.ads ada/err_vars.ads \ - ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_alfa.ads \ - ada/exp_attr.ads ada/exp_ch11.ads ada/exp_ch12.ads ada/exp_ch13.ads \ - ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch5.ads \ - ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch8.ads ada/exp_ch9.ads \ - ada/exp_prag.ads ada/exp_tss.ads ada/expander.ads ada/expander.adb \ - ada/fname.ads ada/hostparm.ads ada/inline.ads ada/lib.ads \ - ada/lib-load.ads ada/namet.ads ada/nlists.ads ada/opt.ads \ + ada/debug_a.adb ada/einfo.ads ada/elists.ads ada/exp_aggr.ads \ + ada/exp_alfa.ads ada/exp_attr.ads ada/exp_ch11.ads ada/exp_ch12.ads \ + ada/exp_ch13.ads ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads \ + ada/exp_ch5.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch8.ads \ + ada/exp_ch9.ads ada/exp_prag.ads ada/exp_tss.ads ada/expander.ads \ + ada/expander.adb ada/fname.ads ada/hostparm.ads ada/inline.ads \ + ada/lib.ads ada/lib-load.ads ada/namet.ads ada/nlists.ads ada/opt.ads \ ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \ ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \ ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \ @@ -2734,25 +2733,25 @@ ada/par.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ada/warnsw.ads ada/widechar.ads ada/par_sco.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ - ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ - ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \ - ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_tss.ads \ - ada/fname.ads ada/gnat.ads ada/g-byorma.ads ada/g-hesorg.ads \ - ada/g-hesorg.adb ada/g-htable.ads ada/g-table.ads ada/g-table.adb \ - ada/hostparm.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \ - ada/lib-sort.adb ada/lib-util.ads ada/lib-util.adb ada/namet.ads \ - ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads ada/osint-c.ads \ - ada/output.ads ada/par_sco.ads ada/par_sco.adb ada/put_scos.ads \ - ada/put_scos.adb ada/scans.ads ada/scos.ads ada/scos.adb ada/sem.ads \ - ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \ - ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \ - ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \ - ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ - ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ - ada/s-strhas.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ - ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \ - ada/types.ads ada/uintp.ads ada/uname.ads ada/unchconv.ads \ - ada/unchdeal.ads ada/urealp.ads ada/widechar.ads + ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/aspects.adb \ + ada/atree.ads ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads \ + ada/einfo.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ + ada/exp_tss.ads ada/fname.ads ada/gnat.ads ada/g-byorma.ads \ + ada/g-hesorg.ads ada/g-hesorg.adb ada/g-htable.ads ada/g-table.ads \ + ada/g-table.adb ada/hostparm.ads ada/lib.ads ada/lib.adb \ + ada/lib-list.adb ada/lib-sort.adb ada/lib-util.ads ada/lib-util.adb \ + ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads \ + ada/osint-c.ads ada/output.ads ada/par_sco.ads ada/par_sco.adb \ + ada/put_scos.ads ada/put_scos.adb ada/scans.ads ada/scos.ads \ + ada/scos.adb ada/sem.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \ + ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \ + ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \ + ada/s-htable.adb ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \ + ada/s-parame.ads ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads \ + ada/s-stoele.adb ada/s-strhas.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uname.ads \ + ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads ada/prep.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/csets.ads \ @@ -2795,12 +2794,12 @@ ada/put_alfa.o : ada/ada.ads ada/a-unccon.ads ada/alfa.ads ada/gnat.ads \ ada/put_scos.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \ ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/namet.ads \ - ada/opt.ads ada/output.ads ada/par_sco.ads ada/put_scos.ads \ - ada/put_scos.adb ada/scos.ads ada/snames.ads ada/system.ads \ - ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ - ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ - ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \ - ada/types.ads ada/unchconv.ads ada/unchdeal.ads + ada/opt.ads ada/output.ads ada/put_scos.ads ada/put_scos.adb \ + ada/scos.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \ + ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads \ + ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ + ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \ + ada/unchdeal.ads ada/repinfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ @@ -3075,34 +3074,34 @@ ada/scng.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/scos.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \ ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/namet.ads \ - ada/opt.ads ada/output.ads ada/scos.ads ada/scos.adb ada/snames.ads \ - ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \ - ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \ - ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ - ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads + ada/opt.ads ada/output.ads ada/scos.ads ada/scos.adb ada/system.ads \ + ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ + ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \ + ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \ + ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/sem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \ ada/alloc.ads ada/aspects.ads ada/atree.ads ada/atree.adb \ ada/casing.ads ada/csets.ads ada/debug.ads ada/debug_a.ads \ ada/debug_a.adb ada/einfo.ads ada/einfo.adb ada/elists.ads \ - ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \ - ada/exp_tss.ads ada/expander.ads ada/fname.ads ada/gnat.ads \ - ada/g-hesorg.ads ada/hostparm.ads ada/inline.ads ada/lib.ads \ - ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \ - ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \ - ada/restrict.ads ada/rident.ads ada/sem.ads ada/sem.adb \ - ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads \ - ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch2.adb \ - ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \ - ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_dim.ads \ - ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \ - ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \ - ada/system.ads ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads \ - ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \ - ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \ - ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ - ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uname.ads \ - ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads + ada/elists.adb ada/exp_tss.ads ada/expander.ads ada/fname.ads \ + ada/gnat.ads ada/g-hesorg.ads ada/hostparm.ads ada/inline.ads \ + ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \ + ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \ + ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads ada/sem.ads \ + ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch10.ads \ + ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \ + ada/sem_ch2.adb ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \ + ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \ + ada/sem_dim.ads ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \ + ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \ + ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-imenne.ads \ + ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \ + ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ + ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ + ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \ + ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \ + ada/widechar.ads ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \ @@ -4372,11 +4371,14 @@ ada/validsw.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads \ ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/validsw.ads \ ada/validsw.adb -ada/warnsw.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads \ - ada/hostparm.ads ada/opt.ads ada/system.ads ada/s-exctab.ads \ - ada/s-stalib.ads ada/s-string.ads ada/s-unstyp.ads ada/s-wchcon.ads \ - ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/warnsw.ads \ - ada/warnsw.adb +ada/warnsw.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ + ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/err_vars.ads \ + ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads \ + ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \ + ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \ + ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ + ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \ + ada/unchdeal.ads ada/warnsw.ads ada/warnsw.adb ada/widechar.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/hostparm.ads ada/interfac.ads ada/opt.ads \ diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index 1d0d2fb2167..28bf9380c1c 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -255,6 +255,8 @@ extern void gigi (Node_Id gnat_root, int max_gnat_node, Entity_Id standard_exception_type, Int gigi_operating_mode); +extern void set_flag_debug_instances (int); + #ifdef __cplusplus } #endif diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index 3d3f16110ce..4c5bd321eaf 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -228,7 +228,9 @@ int optimize_size; int flag_compare_debug; enum stack_check_type flag_stack_check = NO_STACK_CHECK; -/* Post-switch processing. */ +/* Settings adjustments after switches processing by the back-end. + Note that the front-end switches processing (Scan_Compiler_Arguments) + has not been done yet at this point! */ static bool gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) @@ -807,6 +809,23 @@ gnat_eh_personality (void) return gnat_eh_personality_decl; } +/* Set flag_debug_instances. */ + +void +set_flag_debug_instances (int val ATTRIBUTE_UNUSED) +{ +#if 0 + /* Temporary compatibility shim??? + This should be enabled when back-end support for instance info in + DWARF is merged at the FSF. */ + flag_debug_instances = val; +#else + /* Until then, forcibly turn off SCO instance table generation. */ + extern Boolean opt__generate_sco_instance_table; + opt__generate_sco_instance_table = False; +#endif +} + /* Initialize language-specific bits of tree_contains_struct. */ static void diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 6e90c2b6d05..b2e0647c157 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -109,6 +109,9 @@ procedure Gnat1drv is ---------------------------- procedure Adjust_Global_Switches is + procedure set_flag_debug_instances (Val : Int); + pragma Import (C, set_flag_debug_instances); + begin -- Debug flag -gnatd.I is a synonym for Generate_SCIL and requires code -- generation. @@ -573,6 +576,10 @@ procedure Gnat1drv is end if; end if; + -- Set back-end flag_debug_instances from corresponding front-end flag + + set_flag_debug_instances (Boolean'Pos (Generate_SCO_Instance_Table)); + -- Finally capture adjusted value of Suppress_Options as the initial -- value for Scope_Suppress, which will be modified as we move from -- scope to scope (by Suppress/Unsuppress/Overflow_Checks pragmas). diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 759ae5a8f8c..1e54eb0abff 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -1417,41 +1417,43 @@ pragma Check_Float_Overflow; @noindent In Ada, the predefined floating-point types (@code{Short_Float}, @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are -defined as being unconstrained. This means that even though they -have well defined base ranges, there is no requirement that an -overflow exception be raised when the result of an operation is -outside this base range. This definition accomodates the notion +defined to be @emph{unconstrained}. This means that even though each +has a well-defined base range, an operation that delivers a result +outside this base range is not required to raise an exception. +This implementation permission accommodates the notion of infinities in IEEE floating-point, and corresponds to the efficient execution mode on most machines. GNAT will not raise -overflow exceptions on these machines, instead it will generate +overflow exceptions on these machines; instead it will generate infinities and NaN's as defined in the IEEE standard. -Although the generation of infinities is efficient, it is not -always desirable, and it is often the case that it would be -preferable to check for overflows, even if this resulted in -substantially less efficient code. This can be accomplished -by defining your own float subtypes, and indeed such types -can have the same base range as in: +Generating infinities, although efficient, is not always desirable. +Often the preferable approach is to check for overflow, even at the +(perhaps considerable) expense of run-time performance. +This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit +range constraints -- and indeed such a subtype +can have the same base range as its base type. For example: @smallexample @c ada subtype My_Float is Float range Float'Range; @end smallexample @noindent -In this example, @code{My_Float} has the same range as -@code{Float} but it is constrained, so operations on +Here @code{My_Float} has the same range as +@code{Float} but is constrained, so operations on @code{My_Float} values will be checked for overflow against this range. -However, it is often convenient to avoid the need to -define your own floating-point types, and instead use -the standard predefined types. The @code{Check_Float_Overflow} -configuration pragma achieves that. If a unit is compiled +This style will achieve the desired goal, but +it is often more convenient to be able to simply use +the standard predefined floating-point types as long +as overflow checking could be guaranteed. +The @code{Check_Float_Overflow} +configuration pragma achieves this effect. If a unit is compiled subject to this configuration pragma, then all operations on predefined floating-point types will be treated as -though those types were constrained and overflow checks -will be generated, resulting in a @code{Constraint_Error} -exception if the result is out of range. +though those types were constrained, and overflow checks +will be generated. The @code{Constraint_Error} +exception is raised if the result is out of range. This mode can also be set by use of the compiler switch @option{-gnateF}. diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 002f7272ba0..ff008786bfe 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -4586,11 +4586,26 @@ package body Sem_Attr is -- During pre-analysis, Prag is the enclosing pragma node if any begin - -- Find enclosing scopes, excluding loops + -- Find the proper enclosing scope CS := Current_Scope; - while Ekind (CS) = E_Loop loop - CS := Scope (CS); + while Present (CS) loop + + -- Skip generated loops + + if Ekind (CS) = E_Loop then + CS := Scope (CS); + + -- Skip the special _Parent scope generated to capture references + -- to formals during the process of subprogram inlining. + + elsif Ekind (CS) = E_Function + and then Chars (CS) = Name_uParent + then + CS := Scope (CS); + else + exit; + end if; end loop; PS := Scope (CS); diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index d3c735b38ed..ee883327054 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -13001,12 +13001,15 @@ package body Sem_Ch12 is -- an expanded name, it has been rewritten as the renamed -- package, which is necessary semantically but complicates -- ASIS tree traversal, so we recover the original entity to - -- expose the renaming. + -- expose the renaming. Take into account that the context may + -- be a nested generic and that the original node may itself + -- have an associated node. if Ekind (E) = E_Package and then Nkind (Parent (N)) = N_Expanded_Name and then Present (Original_Node (N2)) and then Present (Entity (Original_Node (N2))) + and then Is_Entity_Name (Entity (Original_Node (N2))) then if Is_Global (Entity (Original_Node (N2))) then N2 := Original_Node (N2); diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index ae69b0e1945..c83d1f61fb8 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -12748,7 +12748,6 @@ package body Sem_Prag is when Pragma_Postcondition => Postcondition : declare In_Body : Boolean; - pragma Warnings (Off, In_Body); begin GNAT_Pragma; @@ -12756,10 +12755,22 @@ package body Sem_Prag is Check_At_Most_N_Arguments (2); Check_Optional_Identifier (Arg1, Name_Check); - -- All we need to do here is call the common check procedure, - -- the remainder of the processing is found in Sem_Ch6/Sem_Ch7. + -- Verify the proper placement of the pragma. The remainder of the + -- processing is found in Sem_Ch6/Sem_Ch7. Check_Precondition_Postcondition (In_Body); + + -- When the pragma is a source contruct and appears inside a body, + -- preanalyze the boolean_expression to detect illegal forward + -- references: + + -- procedure P is + -- pragma Postcondition (X'Old ...); + -- X : ... + + if Comes_From_Source (N) and then In_Body then + Preanalyze_Spec_Expression (Expression (Arg1), Any_Boolean); + end if; end Postcondition; ------------------ diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index e80708e67b0..bfa245fd9dc 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -1159,14 +1159,19 @@ package body Sprint is when N_Case_Expression => declare - Alt : Node_Id; + Has_Parens : constant Boolean := Paren_Count (Node) > 0; + Alt : Node_Id; begin -- The syntax for case_expression does not include parentheses, -- but sometimes parentheses are required, so unconditionally - -- generate them here. + -- generate them here unless already present. - Write_Str_With_Col_Check_Sloc ("(case "); + if not Has_Parens then + Write_Char ('('); + end if; + + Write_Str_With_Col_Check_Sloc ("case "); Sprint_Node (Expression (Node)); Write_Str_With_Col_Check (" is"); @@ -1178,7 +1183,9 @@ package body Sprint is Write_Char (','); end loop; - Write_Char (')'); + if not Has_Parens then + Write_Char (')'); + end if; end; when N_Case_Expression_Alternative => @@ -1963,15 +1970,19 @@ package body Sprint is when N_If_Expression => declare - Condition : constant Node_Id := First (Expressions (Node)); - Then_Expr : constant Node_Id := Next (Condition); + Has_Parens : constant Boolean := Paren_Count (Node) > 0; + Condition : constant Node_Id := First (Expressions (Node)); + Then_Expr : constant Node_Id := Next (Condition); begin -- The syntax for if_expression does not include parentheses, -- but sometimes parentheses are required, so unconditionally - -- generate them here. + -- generate them here unless already present. - Write_Str_With_Col_Check_Sloc ("(if "); + if not Has_Parens then + Write_Char ('('); + end if; + Write_Str_With_Col_Check_Sloc ("if "); Sprint_Node (Condition); Write_Str_With_Col_Check (" then "); @@ -1979,11 +1990,16 @@ package body Sprint is if Present (Then_Expr) then Sprint_Node (Then_Expr); - Write_Str_With_Col_Check (" else "); - Sprint_Node (Next (Then_Expr)); + + if Present (Next (Then_Expr)) then + Write_Str_With_Col_Check (" else "); + Sprint_Node (Next (Then_Expr)); + end if; end if; - Write_Char (')'); + if not Has_Parens then + Write_Char (')'); + end if; end; when N_If_Statement => diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index f6d8fee2348..ebb18b0c401 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -618,6 +618,7 @@ package body Switch.C is when 'S' => Generate_SCO := True; + Generate_SCO_Instance_Table := True; Ptr := Ptr + 1; -- -gnatet (generate target dependent information) diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads index cf581773852..96cace5bd96 100644 --- a/gcc/ada/vms_data.ads +++ b/gcc/ada/vms_data.ads @@ -1402,11 +1402,11 @@ package VMS_Data is -- source. S_GCC_ChecksX : aliased constant S := "/NOCHECKS " & - "-gnatp,!-gnato,!-gnatE "; + "-gnatp,!-gnato,!-gnatE"; -- NODOC (see /CHECKS) S_GCC_Chflov : aliased constant S := "/FLOAT_OVERFLOW_CHECK " & - "-gnateF "; + "-gnateF"; -- /NOFLOAT_OVERFLOW_CHECK (D) -- /FLOAT_OVERFLOW_CHECK -- @@ -1414,7 +1414,7 @@ package VMS_Data is -- those using an unconstrained predefined type (i.e. no infinities). S_GCC_Compres : aliased constant S := "/COMPRESS_NAMES " & - "-gnatC "; + "-gnatC"; -- /NOCOMPRESS_NAMES (D) -- /COMPRESS_NAMES --