diff options
author | Arnaud Charlet <charlet@adacore.com> | 2023-02-06 09:06:28 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-23 09:59:06 +0200 |
commit | 375299752727a8b3d5a360905fade38122d82681 (patch) | |
tree | 308cf9a8ea9761b8a12d8dac6109ec5305f406b6 /gcc/ada/styleg.ads | |
parent | a0cc548a8a1b2176bf2f51d1831a4ac6cc255b64 (diff) | |
download | gcc-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.ads | 11 |
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); |