diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-11-26 18:37:09 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-12-15 06:41:56 -0500 |
commit | 7d07d75d69d8d145329b6a81db1fc74f4e3c812b (patch) | |
tree | fb53a0e8d52c4c95343d4f02ac5ac9a454f56bcb | |
parent | 3a6298d639333eb729a2cea441aeaffcff619227 (diff) | |
download | gcc-7d07d75d69d8d145329b6a81db1fc74f4e3c812b.zip gcc-7d07d75d69d8d145329b6a81db1fc74f4e3c812b.tar.gz gcc-7d07d75d69d8d145329b6a81db1fc74f4e3c812b.tar.bz2 |
[Ada] Simplify check for extra parens
gcc/ada/
* par-ch5.adb (P_Condition): Simplify condition for warning
about extra parens and make it easier to understand.
-rw-r--r-- | gcc/ada/par-ch5.adb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index ce02af7..a8d49b1 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -1306,14 +1306,16 @@ package body Ch5 is -- syntax rule. else - if Style_Check and then Paren_Count (Cond) > 0 then - if Nkind (Cond) not in N_If_Expression - | N_Case_Expression + if Style_Check + and then + Paren_Count (Cond) > + (if Nkind (Cond) in N_Case_Expression + | N_If_Expression | N_Quantified_Expression - or else Paren_Count (Cond) > 1 - then - Style.Check_Xtra_Parens (First_Sloc (Cond)); - end if; + then 1 + else 0) + then + Style.Check_Xtra_Parens (First_Sloc (Cond)); end if; -- And return the result |