aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/styleg.ads
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2023-02-06 09:06:28 +0000
committerMarc Poulhiès <poulhies@adacore.com>2023-05-23 09:59:06 +0200
commit375299752727a8b3d5a360905fade38122d82681 (patch)
tree308cf9a8ea9761b8a12d8dac6109ec5305f406b6 /gcc/ada/styleg.ads
parenta0cc548a8a1b2176bf2f51d1831a4ac6cc255b64 (diff)
downloadgcc-375299752727a8b3d5a360905fade38122d82681.zip
gcc-375299752727a8b3d5a360905fade38122d82681.tar.gz
gcc-375299752727a8b3d5a360905fade38122d82681.tar.bz2
ada: Add new switch -gnatyz
Improve -gnatyx to check additional complete conditions, and introduce a new switch -gnatyz to check for unnecessary parentheses according to operator precedence rules. Enable -gnatyz as part of -gnatyg. gcc/ada/ * par-ch5.adb, style.ads, styleg.adb, styleg.ads (Check_Xtra_Parens): Remove extra parameter Enable. (Check_Xtra_Parens_Precedence): New. (P_Case_Statement): Add -gnatyx style check. * sem_ch4.adb: Replace calls to Check_Xtra_Parens by Check_Xtra_Parens_Precedence. * stylesw.ads, stylesw.adb, usage.adb: Add support for -gnatyz. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update -gnatyxzg doc. * sem_prag.adb, libgnat/s-regpat.adb, libgnarl/s-interr__hwint.adb, libgnarl/s-interr__vxworks.adb: Remove extra parens. * par-ch3.adb (P_Discrete_Range): Do not emit a style check if the expression is not a simple expression. * gnat_ugn.texi: Regenerate.
Diffstat (limited to 'gcc/ada/styleg.ads')
-rw-r--r--gcc/ada/styleg.ads11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/ada/styleg.ads b/gcc/ada/styleg.ads
index aa4f65e..7a610a1 100644
--- a/gcc/ada/styleg.ads
+++ b/gcc/ada/styleg.ads
@@ -160,10 +160,13 @@ package Styleg is
procedure Check_Vertical_Bar;
-- Called after scanning a vertical bar to check spacing
- procedure Check_Xtra_Parens (N : Node_Id; Enable : Boolean);
- -- Called after scanning an expression (N) that does not require an extra
- -- level of parentheses around the entire expression.
- -- Enable is a temporary parameter before enabling these checks by default.
+ procedure Check_Xtra_Parens (N : Node_Id);
+ -- Called after scanning an entire expression (N) that does not require an
+ -- extra level of parentheses.
+
+ procedure Check_Xtra_Parens_Precedence (N : Node_Id);
+ -- Called after scanning a subexpression (N) that does not require an
+ -- extra level of parentheses according to operator precedence rules.
function Mode_In_Check return Boolean;
pragma Inline (Mode_In_Check);