Skip to content

Commit

Permalink
Amend style switches (expand -gnatyg).
Browse files Browse the repository at this point in the history
-gnatyg is "check standard GNAT style rules, same as ydISux", but in
GCC 14 it will include a new switch, -gnatyz (check parentheses not
required by operator precedence rules) which will mean that use of
extra parens to clarify intent without deep knowledge of the rules
will trigger fatal warnings; for example in alire-conditional_trees.adb

   function Contains_ORs (This : Tree) return Boolean is
      ((not This.Is_Empty) and then This.Root.Contains_ORs);
       ^

Refer GCC Bugzilla PR 112446.

  * alire_common.gpr (Style_Check_Switches): Remove -gnatyg and replace
    by the pre-GCC 14 equivalent.
  • Loading branch information
simonjwright committed Nov 9, 2023
1 parent 88f17ab commit 8fa103a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion alire_common.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ abstract project Alire_Common is
case Style_Check_Mode is
when "enabled" => Style_Check_Switches :=
("-gnatwe", -- Warnings as errors
"-gnatyg", -- Standard checks
"-gnatyd", -- no DOS line terminators
"-gnatyI", -- no IN mode
"-gnatyO", -- all overrides
"-gnatyS", -- separate lines after THEN/ELSE
"-gnatyu", -- no unnecessary blank lines
"-gnatyx", -- no extra parens around conditionals
"-gnaty-s"); -- relax fwd decl
when "disabled" => Style_Check_Switches := ();
end case;
Expand Down

0 comments on commit 8fa103a

Please sign in to comment.