diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-12-05 12:11:28 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-12-05 12:11:28 +0100 |
commit | af31bd57502fd7fef4891658c74cb5fdb3c160e4 (patch) | |
tree | c8dd05dbdd00dad1308438f3cbe9bce27eadebaf /gcc/ada/par-ch5.adb | |
parent | 7b55fea6d7c6e40c769d04fc4ed42d6c556941df (diff) | |
download | gcc-af31bd57502fd7fef4891658c74cb5fdb3c160e4.zip gcc-af31bd57502fd7fef4891658c74cb5fdb3c160e4.tar.gz gcc-af31bd57502fd7fef4891658c74cb5fdb3c160e4.tar.bz2 |
[multiple changes]
2012-12-05 Robert Dewar <dewar@adacore.com>
* atree.ads, par-ch4.adb, sem_attr.adb, sem_ch13.adb: Minor
reformatting.
2012-12-05 Eric Botcazou <ebotcazou@adacore.com>
* gnat_ugn.texi (Switches for gcc): Document -flto and reorder.
2012-12-05 Ed Schonberg <schonberg@adacore.com>
* par-ch5.adb (P_Condition): Handle properly Ada 2012
expressions that must be parenthesized before checking for
redundant parentheses when that check is enabled.
From-SVN: r194210
Diffstat (limited to 'gcc/ada/par-ch5.adb')
-rw-r--r-- | gcc/ada/par-ch5.adb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index e86f01c..d6d6b2f 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1276,13 +1276,21 @@ package body Ch5 is return Cond; - -- Otherwise check for redundant parens + -- 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. else - if Style_Check - and then Paren_Count (Cond) > 0 - then - Style.Check_Xtra_Parens (First_Sloc (Cond)); + if Style_Check and then Paren_Count (Cond) > 0 then + if not Nkind_In (Cond, N_If_Expression, + N_Case_Expression, + N_Quantified_Expression) + or else Paren_Count (Cond) > 1 + then + Style.Check_Xtra_Parens (First_Sloc (Cond)); + end if; end if; -- And return the result |