Skip to content

Amend style switches (expand -gnatyg).#1497

Merged
mosteo merged 1 commit into
alire-project:masterfrom
simonjwright:amend-style-switches
Nov 14, 2023
Merged

Amend style switches (expand -gnatyg).#1497
mosteo merged 1 commit into
alire-project:masterfrom
simonjwright:amend-style-switches

Conversation

@simonjwright

Copy link
Copy Markdown
Contributor

-gnatyg is (GCC <= 13) "check standard GNAT style rules, same as ydISux". Long-term, it would be better to use that set of rules explicitly rather than depending on a set of style rules outside our control.

In GCC 14 -gnatyg will include a new switch, -gnatyz (check parentheses not required by operator precedence rules); refer GCC Bugzilla PR 112466.

This change to -gnatyg will mean that use of extra parens to clarify intent for readers who don’t have deep knowledge of the precedence rules will trigger warnings, fatal given -gnatwe; 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);
       ^-----------------^
  • alire_common.gpr (Style_Check_Switches): Remove -gnatyg and replace by the pre-GCC 14 equivalent.

-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.
@mosteo mosteo merged commit 04273a8 into alire-project:master Nov 14, 2023
@mosteo

mosteo commented Nov 14, 2023

Copy link
Copy Markdown
Member

Thanks, Simon.

@simonjwright simonjwright deleted the amend-style-switches branch November 14, 2023 14:31
mosteo pushed a commit to mosteo/alire that referenced this pull request Nov 15, 2023
-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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants