[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.
This commit is contained in:
Piotr Trojanek 2020-11-26 18:37:09 +01:00 committed by Pierre-Marie de Rodat
parent 3a6298d639
commit 7d07d75d69

View File

@ -1306,14 +1306,16 @@ package body Ch5 is
-- syntax rule. -- syntax rule.
else else
if Style_Check and then Paren_Count (Cond) > 0 then if Style_Check
if Nkind (Cond) not in N_If_Expression and then
| N_Case_Expression Paren_Count (Cond) >
(if Nkind (Cond) in N_Case_Expression
| N_If_Expression
| N_Quantified_Expression | N_Quantified_Expression
or else Paren_Count (Cond) > 1 then 1
then else 0)
Style.Check_Xtra_Parens (First_Sloc (Cond)); then
end if; Style.Check_Xtra_Parens (First_Sloc (Cond));
end if; end if;
-- And return the result -- And return the result