Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amend style switches (expand -gnatyg). #1497

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

simonjwright
Copy link
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
13 checks passed
@mosteo
Copy link
Member

mosteo commented Nov 14, 2023

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