https://gcc.gnu.org/g:dc633955e9e9a9e9f4c3da4c5b823d5c7a994411
commit r17-780-gdc633955e9e9a9e9f4c3da4c5b823d5c7a994411 Author: Bob Duff <[email protected]> Date: Mon Feb 2 13:08:37 2026 -0500 ada: Tech debt: Remove Is_Boolean_Aspect Remove the Is_Boolean_Aspect flag. It was unnecessary, and anyway, the comment on it was wrong. Misc comment improvement. gcc/ada/ChangeLog: * gen_il-fields.ads (Is_Boolean_Aspect): Remove. * gen_il-gen-gen_nodes.adb: Likewise. * sinfo.ads: Likewise. * sem_ch13.adb: Likewise. Minor comment fix. * aspects.ads: Clean up comments, including removing some redundancy. * freeze.adb: Fix comment typo. * sem_eval.ads: Fix comment typo. * tbuild.ads: Fix comment; there's no reason to mention the number, especially when it's wrong. Diff: --- gcc/ada/aspects.ads | 42 +++++++++++++++++++++------------------- gcc/ada/freeze.adb | 2 +- gcc/ada/gen_il-fields.ads | 1 - gcc/ada/gen_il-gen-gen_nodes.adb | 1 - gcc/ada/sem_ch13.adb | 13 ++++++++----- gcc/ada/sem_eval.ads | 2 +- gcc/ada/sinfo.ads | 4 ---- gcc/ada/tbuild.ads | 2 +- 8 files changed, 33 insertions(+), 34 deletions(-) diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index d9d6fed4fbc0..c7d73b1b2b50 100644 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -70,7 +70,7 @@ package Aspects is type Aspect_Id is (No_Aspect, -- Dummy entry for no aspect - -- The following aspects do not have a (static) boolean value + -- The following aspects do not have a Boolean value Aspect_Abstract_State, -- GNAT Aspect_Address, @@ -171,7 +171,7 @@ package Aspects is Aspect_Warnings, -- GNAT Aspect_Write, - -- The following aspects correspond to library unit pragmas + -- The following are in subtype Library_Unit_Aspects Aspect_All_Calls_Remote, Aspect_Elaborate_Body, @@ -182,12 +182,7 @@ package Aspects is Aspect_Remote_Types, Aspect_Shared_Passive, - -- Remaining aspects have a static boolean value that turns the aspect - -- on or off. They all correspond to pragmas, but are only converted to - -- the pragmas where the value is True. A value of False normally means - -- that the aspect is ignored, except in the case of derived types where - -- the aspect value is inherited from the parent, in which case, we do - -- not allow False if we inherit a True value from the parent. + -- The following are in subtype Boolean_Aspects Aspect_Always_Terminates, -- GNAT Aspect_Asynchronous, @@ -374,6 +369,7 @@ package Aspects is Aspect_Warnings => True, Ignored_Aspects => True, others => False); + -- end Implementation_Defined_Aspect -- The following array indicates aspects that specify operational -- characteristics, and thus can be specified on partial views. @@ -407,15 +403,19 @@ package Aspects is Aspect_Id range Aspect_All_Calls_Remote .. Aspect_Shared_Passive; -- The following subtype defines aspects accepting an optional static - -- boolean parameter indicating if the aspect should be active or - -- cancelling. If the parameter is missing the effective value is True, - -- enabling the aspect. If the parameter is present it must be a static - -- expression of type Standard.Boolean. If the value is True, then the - -- aspect is enabled. If it is False, the aspect is disabled. + -- Boolean parameter. If the parameter is missing the effective value is + -- True. These aspects all correspond to pragmas, but are only converted to + -- the pragmas if the value is True. A value of False normally means + -- that the aspect is ignored, except in the case of derived types where + -- the aspect value is inherited from the parent, in which case we do + -- not allow False if we inherit a True value from the parent. -- - -- The Always_Terminates fits in this category even though it accepts an - -- optional boolean parameter which is non-static, because we want it to - -- be usable with pragma User_Defined_Aspect. + -- Always_Terminates fits in this category even though it accepts a + -- nonstatic value, because we want it to be usable with pragma + -- User_Aspect_Definition. + -- + -- Note that this does not include all Boolean-valued aspects; in + -- particular, the Library_Unit_Aspects are also of type Boolean. subtype Boolean_Aspects is Aspect_Id range Aspect_Always_Terminates .. Aspect_Id'Last; @@ -537,6 +537,7 @@ package Aspects is Ignored_Aspects => Optional_Expression, Library_Unit_Aspects => Optional_Expression, Boolean_Aspects => Optional_Expression); + -- end Aspect_Argument -- The following array indicates what aspects are representation aspects @@ -699,6 +700,7 @@ package Aspects is Aspect_Volatile_Full_Access => True, Aspect_Volatile_Function => False, Aspect_Yield => False); + -- end Is_Representation_Aspect ----------------------------------------- -- Table Linking Names and Aspect_Id's -- @@ -871,7 +873,7 @@ package Aspects is Aspect_Volatile_Function => Name_Volatile_Function, Aspect_Warnings => Name_Warnings, Aspect_Write => Name_Write, - Aspect_Yield => Name_Yield); + Aspect_Yield => Name_Yield); -- Aspect_Names function Get_Aspect_Id (Name : Name_Id) return Aspect_Id; pragma Inline (Get_Aspect_Id); @@ -1206,9 +1208,9 @@ package Aspects is Aspect_Warnings => True, others => False); - ------------------------------------------------------------------- - -- Handling of Aspects Specifications on Single Concurrent Types -- - ------------------------------------------------------------------- + ------------------------------------------------------------------ + -- Handling of Aspect Specifications on Single Concurrent Types -- + ------------------------------------------------------------------ -- Certain aspects that appear on the following nodes diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index d989b2c27b05..13d3a7f2e34d 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -3107,7 +3107,7 @@ package body Freeze is A => Aspect_No_Parts); end if; - -- Examine aspects specifications on private type declarations + -- Examine aspect specifications on private type declarations -- Should Find_Aspect be improved to handle this case ??? diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index 56e6b90f8aef..ea0d91dcca64 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -233,7 +233,6 @@ package Gen_IL.Fields is Is_Accessibility_Actual, Is_Analyzed_Pragma, Is_Asynchronous_Call_Block, - Is_Boolean_Aspect, Is_Checked, Is_Checked_Ghost_Pragma, Is_Component_Left_Opnd, diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index efa510a9360b..3f145151ea4f 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -1143,7 +1143,6 @@ begin -- Gen_IL.Gen.Gen_Nodes Sm (Aspect_Subprograms, Elist_Id), Sm (Entity_Or_Associated_Node, Node_Id), -- just Entity Sm (Expression_Copy, Node_Id), - Sm (Is_Boolean_Aspect, Flag), Sm (Is_Checked, Flag), Sm (Is_Delayed_Aspect, Flag), Sm (Is_Disabled, Flag), diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 388f1ad1d92b..20c8b670edaa 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -2094,7 +2094,9 @@ package body Sem_Ch13 is -- An auxiliary node Delay_Required : Boolean; - -- Set False if delay is not required + -- Indicates delayed aspects. Note that this is somewhat of a + -- misnomer: False doesn't just mean delaying is optional; in + -- some cases, it means delaying won't work. Eloc : Source_Ptr := No_Location; -- Source location of expression, modified when we split PPC's. It @@ -5491,8 +5493,6 @@ package body Sem_Ch13 is when Boolean_Aspects | Library_Unit_Aspects => - Set_Is_Boolean_Aspect (Aspect); - -- Lock_Free aspect only apply to protected objects if A_Id = Aspect_Lock_Free then @@ -5862,7 +5862,8 @@ package body Sem_Ch13 is -- library unit pragmas are better handled early. if Nkind (Parent (N)) = N_Compilation_Unit - and then (Present (Aitem) or else Is_Boolean_Aspect (Aspect)) + and then (Present (Aitem) + or else A_Id in Boolean_Aspects | Library_Unit_Aspects) then declare Aux : constant Node_Id := Aux_Decls_Node (Parent (N)); @@ -5873,7 +5874,9 @@ package body Sem_Ch13 is -- For a Boolean aspect, create the corresponding pragma if -- no expression or if the value is True. - if Is_Boolean_Aspect (Aspect) and then No (Aitem) then + if A_Id in Boolean_Aspects | Library_Unit_Aspects + and then No (Aitem) + then if Is_True (Static_Boolean (Expr)) then Aitem := Make_Aitem_Pragma (Pragma_Argument_Associations => New_List ( diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads index fabf4cd2c85f..005c577f3273 100644 --- a/gcc/ada/sem_eval.ads +++ b/gcc/ada/sem_eval.ads @@ -97,7 +97,7 @@ package Sem_Eval is -- For most legality checking purposes the flag Is_Static_Expression -- defined in Sinfo should be used. This package also provides a routine - -- called Is_OK_Static_Expression which in addition of checking that an + -- called Is_OK_Static_Expression which in addition to checking that an -- expression is static in the RM 4.9 sense, it checks that the expression -- does not raise constraint error. In fact for certain legality checks not -- only do we need to ascertain that the expression is static, but we must diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 3d15d3e3118d..27f88cd914e6 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1522,10 +1522,6 @@ package Sinfo is -- expansion of an asynchronous entry call. Such a block needs cleanup -- handler to assure that the call is cancelled. - -- Is_Boolean_Aspect - -- Present in N_Aspect_Specification node. Set if the aspect is for a - -- boolean aspect (i.e. Aspect_Id is in Boolean_Aspect subtype). - -- Is_Checked -- Present in N_Aspect_Specification and N_Pragma nodes. Set for an -- assertion aspect or pragma, or check pragma for an assertion, that diff --git a/gcc/ada/tbuild.ads b/gcc/ada/tbuild.ads index 3478c0c51b06..0d9788213df4 100644 --- a/gcc/ada/tbuild.ads +++ b/gcc/ada/tbuild.ads @@ -359,7 +359,7 @@ package Tbuild is procedure Set_NUA (Attr : Name_Id; OK : out Boolean); procedure Set_NUP (Prag : Name_Id; OK : out Boolean); -- Subprograms for call to Get_Target_Parameters in Gnat1drv, see spec - -- of package Targparm for full description of these four subprograms. + -- of package Targparm for full description of these subprograms. -- These have to be declared at the top level of a package (accessibility -- issues), and Gnat1drv is a procedure, so they can't go there.
