aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch5.adb
diff options
context:
space:
mode:
authorGhjuvan Lacambre <lacambre@adacore.com>2021-01-11 16:26:45 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-05 04:19:02 -0400
commitd2b075f3de988b9c3bfabd06c585d5670dbcdadf (patch)
tree37e1f6c1128249120b838e5b52c1b35b246f72ae /gcc/ada/par-ch5.adb
parent5d0e32b0e44ffbe2493fc2a5075e281a9fa18adf (diff)
downloadgcc-d2b075f3de988b9c3bfabd06c585d5670dbcdadf.zip
gcc-d2b075f3de988b9c3bfabd06c585d5670dbcdadf.tar.gz
gcc-d2b075f3de988b9c3bfabd06c585d5670dbcdadf.tar.bz2
[Ada] Don't emit style errors when parens are required
gcc/ada/ * par-ch5.adb (P_Condition): Check if expression is declare expression.
Diffstat (limited to 'gcc/ada/par-ch5.adb')
-rw-r--r--gcc/ada/par-ch5.adb9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb
index 9d0ac2c..7f82557 100644
--- a/gcc/ada/par-ch5.adb
+++ b/gcc/ada/par-ch5.adb
@@ -1299,17 +1299,16 @@ package body Ch5 is
return Cond;
- -- Otherwise check for redundant parentheses
-
- -- If the condition is a conditional or a quantified expression, it is
- -- parenthesized in the context of a condition, because of a separate
- -- syntax rule.
+ -- Otherwise check for redundant parentheses but do not emit messages
+ -- about expressions that require parentheses (e.g. conditional,
+ -- quantified or declaration expressions).
else
if Style_Check
and then
Paren_Count (Cond) >
(if Nkind (Cond) in N_Case_Expression
+ | N_Expression_With_Actions
| N_If_Expression
| N_Quantified_Expression
then 1