diff options
-rw-r--r-- | gcc/ada/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/ada/atree.ads | 7 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 48 | ||||
-rw-r--r-- | gcc/ada/par-ch4.adb | 8 | ||||
-rw-r--r-- | gcc/ada/par-ch5.adb | 20 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 108 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 4 |
7 files changed, 134 insertions, 76 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index de4c3cafa40..c0e6d1aa15e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2012-12-05 Robert Dewar <dewar@adacore.com> + + * atree.ads, par-ch4.adb, sem_attr.adb, sem_ch13.adb: Minor + reformatting. + +2012-12-05 Eric Botcazou <ebotcazou@adacore.com> + + * gnat_ugn.texi (Switches for gcc): Document -flto and reorder. + +2012-12-05 Ed Schonberg <schonberg@adacore.com> + + * par-ch5.adb (P_Condition): Handle properly Ada 2012 + expressions that must be parenthesized before checking for + redundant parentheses when that check is enabled. + 2012-12-05 Ed Schonberg <schonberg@adacore.com> * par-ch4.adb (P_Allocator): In Ada 2012 (AI05-0104) an diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads index ac27b3fbae3..e685ead0049 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -105,6 +105,11 @@ package Atree is -- is used to indicate the real value. Set to zero for -- non-subexpression nodes. + -- Note: the required parentheses surrounding conditional + -- and quantified expressions count as a level of parens + -- for this purposes, so e.g. in X := (if A then B else C); + -- Paren_Count for the right side will be 1. + -- Comes_From_Source -- This flag is present in all nodes. It is set if the -- node is built by the scanner or parser, and clear if @@ -305,7 +310,7 @@ package Atree is Configurable_Run_Time_Violations : Nat := 0; -- Count of configurable run time violations so far. This is used to -- suppress certain cascaded error messages when we know that we may not - -- have fully expanded some items, due to high integrity violations (i.e. + -- have fully expanded some items, due to high integrity violations (e.g. -- the use of constructs not permitted by the library in use, or improper -- constructs in No_Run_Time mode). diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 199f920453c..176c01db3b7 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -4004,6 +4004,41 @@ cannot use this approach, because the binder must be run and @command{gcc} cannot be used to run the GNAT binder. @end ifclear +@item -fcallgraph-info@r{[}=su,da@r{]} +@cindex @option{-fcallgraph-info} (@command{gcc}) +Makes the compiler output callgraph information for the program, on a +per-file basis. The information is generated in the VCG format. It can +be decorated with additional, per-node and/or per-edge information, if a +list of comma-separated markers is additionally specified. When the +@var{su} marker is specified, the callgraph is decorated with stack usage information; it is equivalent to @option{-fstack-usage}. When the @var{da} +marker is specified, the callgraph is decorated with information about +dynamically allocated objects. + +@item -fdump-scos +@cindex @option{-fdump-scos} (@command{gcc}) +Generates SCO (Source Coverage Obligation) information in the ALI file. +This information is used by advanced coverage tools. See unit @file{SCOs} +in the compiler sources for details in files @file{scos.ads} and +@file{scos.adb}. + +@item -flto@r{[}=n@r{]} +@cindex @option{-flto} (@command{gcc}) +Enables Link Time Optimization. This switch must be used in conjunction +with the traditional @option{-Ox} switches and instructs the compiler to +defer most optimizations until the link stage. The advantage of this +approach is that the compiler can do a whole-program analysis and choose +the best interprocedural optimization strategy based on a complete view +of the program, instead of a fragmentary view with the usual approach. +This can also speed up the compilation of huge programs and reduce the +size of the final executable, compared with a per-unit compilation with +full inlining across modules enabled with the @option{-gnatn2} switch. +The drawback of this approach is that it may require much more memory. +The switch, as well as the accompanying @option{-Ox} switches, must be +specified both for the compilation and the link phases. +If the @var{n} parameter is specified, the optimization and final code +generation at link time are executed using @var{n} parallel jobs by +means of an installed @command{make} program. + @item -fno-inline @cindex @option{-fno-inline} (@command{gcc}) Suppresses all inlining, even if other optimization or inlining @@ -4053,19 +4088,6 @@ See @ref{Stack Overflow Checking} for details. Makes the compiler output stack usage information for the program, on a per-subprogram basis. See @ref{Static Stack Usage Analysis} for details. -@item -fcallgraph-info@r{[}=su@r{]} -@cindex @option{-fcallgraph-info} (@command{gcc}) -Makes the compiler output callgraph information for the program, on a -per-file basis. The information is generated in the VCG format. It can -be decorated with stack-usage per-node information. - -@item -fdump-scos -@cindex @option{-fdump-scos} (@command{gcc}) -Generate SCO (Source Coverage Obligation) information in the ALI file. -This information is used by advanced coverage tools. See unit @file{SCOs} -in the compiler sources for details in files @file{scos.ads} and -@file{scos.adb}. - @item ^-g^/DEBUG^ @cindex @option{^-g^/DEBUG^} (@command{gcc}) Generate debugging information. This information is stored in the object diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 4ea664d0bc2..185a07d97c2 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -2929,16 +2929,14 @@ package body Ch4 is (Alloc_Node, P_Subtype_Indication (Type_Node, Null_Exclusion_Present)); - -- AI05-0104 : an explicit null exclusion is not allowed for an + -- AI05-0104: An explicit null exclusion is not allowed for an -- allocator without initialization. In previous versions of the -- language it just raises constraint error. - if Ada_Version >= Ada_2012 - and then Null_Exclusion_Present - then + if Ada_Version >= Ada_2012 and then Null_Exclusion_Present then Error_Msg_N ("an allocator with a subtype indication " - & "cannot have a null exclusion", Alloc_Node); + & "cannot have a null exclusion", Alloc_Node); end if; end if; diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index e86f01c9155..d6d6b2f276d 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1276,13 +1276,21 @@ package body Ch5 is return Cond; - -- Otherwise check for redundant parens + -- Otherwise check for redundant parentheses + + -- If the condition is a conditional or a quantified expression, it is + -- parenthesized in the context of a condition, because of a separate + -- syntax rule. else - if Style_Check - and then Paren_Count (Cond) > 0 - then - Style.Check_Xtra_Parens (First_Sloc (Cond)); + if Style_Check and then Paren_Count (Cond) > 0 then + if not Nkind_In (Cond, N_If_Expression, + N_Case_Expression, + N_Quantified_Expression) + or else Paren_Count (Cond) > 1 + then + Style.Check_Xtra_Parens (First_Sloc (Cond)); + end if; end if; -- And return the result diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index a6ac9cae548..836c278621e 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -6859,9 +6859,11 @@ package body Sem_Attr is -------------- when Attribute_Adjacent => - Fold_Ureal (N, - Eval_Fat.Adjacent - (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static); + Fold_Ureal + (N, + Eval_Fat.Adjacent + (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), + Static); --------- -- Aft -- @@ -6946,8 +6948,8 @@ package body Sem_Attr is ------------- when Attribute_Ceiling => - Fold_Ureal (N, - Eval_Fat.Ceiling (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Ceiling (P_Base_Type, Expr_Value_R (E1)), Static); -------------------- -- Component_Size -- @@ -6963,10 +6965,10 @@ package body Sem_Attr is ------------- when Attribute_Compose => - Fold_Ureal (N, - Eval_Fat.Compose - (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), - Static); + Fold_Ureal + (N, + Eval_Fat.Compose (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), + Static); ----------------- -- Constrained -- @@ -6983,9 +6985,11 @@ package body Sem_Attr is --------------- when Attribute_Copy_Sign => - Fold_Ureal (N, - Eval_Fat.Copy_Sign - (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static); + Fold_Ureal + (N, + Eval_Fat.Copy_Sign + (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), + Static); -------------- -- Definite -- @@ -7180,8 +7184,8 @@ package body Sem_Attr is ----------- when Attribute_Floor => - Fold_Ureal (N, - Eval_Fat.Floor (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Floor (P_Base_Type, Expr_Value_R (E1)), Static); ---------- -- Fore -- @@ -7197,8 +7201,8 @@ package body Sem_Attr is -------------- when Attribute_Fraction => - Fold_Ureal (N, - Eval_Fat.Fraction (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Fraction (P_Base_Type, Expr_Value_R (E1)), Static); ----------------------- -- Has_Access_Values -- @@ -7334,9 +7338,10 @@ package body Sem_Attr is -- T'Emax = 4 * T'Mantissa - Fold_Ureal (N, - Ureal_2 ** (4 * Mantissa) * (Ureal_1 - Ureal_2 ** (-Mantissa)), - True); + Fold_Ureal + (N, + Ureal_2 ** (4 * Mantissa) * (Ureal_1 - Ureal_2 ** (-Mantissa)), + True); end if; --------------- @@ -7416,9 +7421,11 @@ package body Sem_Attr is ------------------ when Attribute_Leading_Part => - Fold_Ureal (N, - Eval_Fat.Leading_Part - (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), Static); + Fold_Ureal + (N, + Eval_Fat.Leading_Part + (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), + Static); ------------ -- Length -- @@ -7498,10 +7505,11 @@ package body Sem_Attr is ------------- when Attribute_Machine => - Fold_Ureal (N, - Eval_Fat.Machine - (P_Base_Type, Expr_Value_R (E1), Eval_Fat.Round, N), - Static); + Fold_Ureal + (N, + Eval_Fat.Machine + (P_Base_Type, Expr_Value_R (E1), Eval_Fat.Round, N), + Static); ------------------ -- Machine_Emax -- @@ -7574,8 +7582,8 @@ package body Sem_Attr is -- though the non-determinism is certainly permitted. when Attribute_Machine_Rounding => - Fold_Ureal (N, - Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static); -------------------- -- Machine_Rounds -- @@ -7805,8 +7813,8 @@ package body Sem_Attr is ----------- when Attribute_Model => - Fold_Ureal (N, - Eval_Fat.Model (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Model (P_Base_Type, Expr_Value_R (E1)), Static); ---------------- -- Model_Emin -- @@ -7902,14 +7910,14 @@ package body Sem_Attr is -- Floating-point case if Is_Floating_Point_Type (P_Type) then - Fold_Ureal (N, - Eval_Fat.Pred (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Pred (P_Base_Type, Expr_Value_R (E1)), Static); -- Fixed-point case elsif Is_Fixed_Point_Type (P_Type) then - Fold_Ureal (N, - Expr_Value_R (E1) - Small_Value (P_Type), True); + Fold_Ureal + (N, Expr_Value_R (E1) - Small_Value (P_Type), True); -- Modular integer case (wraps) @@ -8051,8 +8059,8 @@ package body Sem_Attr is -------------- when Attribute_Rounding => - Fold_Ureal (N, - Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static); --------------- -- Safe_Emax -- @@ -8125,9 +8133,11 @@ package body Sem_Attr is ------------- when Attribute_Scaling => - Fold_Ureal (N, - Eval_Fat.Scaling - (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), Static); + Fold_Ureal + (N, + Eval_Fat.Scaling + (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), + Static); ------------------ -- Signed_Zeros -- @@ -8240,14 +8250,13 @@ package body Sem_Attr is -- Floating-point case if Is_Floating_Point_Type (P_Type) then - Fold_Ureal (N, - Eval_Fat.Succ (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, Eval_Fat.Succ (P_Base_Type, Expr_Value_R (E1)), Static); -- Fixed-point case elsif Is_Fixed_Point_Type (P_Type) then - Fold_Ureal (N, - Expr_Value_R (E1) + Small_Value (P_Type), Static); + Fold_Ureal (N, Expr_Value_R (E1) + Small_Value (P_Type), Static); -- Modular integer case (wraps) @@ -8282,8 +8291,10 @@ package body Sem_Attr is ---------------- when Attribute_Truncation => - Fold_Ureal (N, - Eval_Fat.Truncation (P_Base_Type, Expr_Value_R (E1)), Static); + Fold_Ureal + (N, + Eval_Fat.Truncation (P_Base_Type, Expr_Value_R (E1)), + Static); ---------------- -- Type_Class -- @@ -8347,9 +8358,10 @@ package body Sem_Attr is ----------------------- when Attribute_Unbiased_Rounding => - Fold_Ureal (N, - Eval_Fat.Unbiased_Rounding (P_Base_Type, Expr_Value_R (E1)), - Static); + Fold_Ureal + (N, + Eval_Fat.Unbiased_Rounding (P_Base_Type, Expr_Value_R (E1)), + Static); ------------------------- -- Unconstrained_Array -- diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 93889d4f274..8bdf27ff18a 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1906,9 +1906,7 @@ package body Sem_Ch13 is -- is mandated by the semantics of the aspect. Verify that -- this a scalar type, to prevent cascaded errors. - if A_Id = Aspect_Default_Value - and then Is_Scalar_Type (E) - then + if A_Id = Aspect_Default_Value and then Is_Scalar_Type (E) then Set_Has_Delayed_Aspects (Base_Type (E)); Record_Rep_Item (Base_Type (E), Aspect); end if; |