diff options
author | Marc Poulhiès <poulhies@adacore.com> | 2022-01-28 16:55:43 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-12 12:38:34 +0000 |
commit | 7a4892d2279066f5892a2b6a8c511689631d8f09 (patch) | |
tree | 6becd5efcffef1731fcb790743d195b61624920b /gcc/ada/styleg.adb | |
parent | b9cff88ca79664ade8bd1c870d01b56f8599afa4 (diff) | |
download | gcc-7a4892d2279066f5892a2b6a8c511689631d8f09.zip gcc-7a4892d2279066f5892a2b6a8c511689631d8f09.tar.gz gcc-7a4892d2279066f5892a2b6a8c511689631d8f09.tar.bz2 |
[Ada] Fix style checking rule for square brackets in Ada 2022 and above
The square bracket syntax introduced in Ada 2022 was incorrectly handled
by the style checker and incorrect spacing was enforced. The issue was
in part caused by the wide character syntax (support removed starting
from Ada 2022) that treats the square bracket as a valid identifier
character.
gcc/ada/
* csets.adb (Initialize): Only treat square bracket as valid
identifier character for Ada versions prior to Ada 2022.
* style.ads (Check_Left_Paren): Rename...
(Check_Left_Paren_Square_Bracket): ...to this.
* styleg.adb (Check_Left_Bracket): Rename...
(Check_Left_Paren_Square_Bracket): ...to this.
* styleg.ads (Check_Left_Paren): Rename...
(Check_Left_Paren_Square_Bracket): ...to this.
* scng.adb (Scan): Add check for spacing around left square
bracket and use new name for Check_Left_Paren_Square_Bracket.
* libgnat/a-szmzco.ads (Control_Ranges, Graphic_Ranges)
(Letter_Ranges, Decimal_Digit_Ranges, ISO_646_Ranges)
(Character_Ranges): Fix style (remove extra space).
* libgnat/a-swmwco.ads (Control_Ranges, Graphic_Ranges)
(Letter_Ranges, Decimal_Digit_Ranges, ISO_646_Ranges)
(Character_Ranges): Likewise.
* opt.adb (Set_Config_Switches): Remove [ from Identifier_Char
set.
Diffstat (limited to 'gcc/ada/styleg.adb')
-rw-r--r-- | gcc/ada/styleg.adb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb index 205bad0..6a785b5 100644 --- a/gcc/ada/styleg.adb +++ b/gcc/ada/styleg.adb @@ -721,15 +721,16 @@ package body Styleg is end if; end Check_Indentation; - ---------------------- - -- Check_Left_Paren -- - ---------------------- + ------------------------------------- + -- Check_Left_Paren_Square_Bracket -- + ------------------------------------- -- In check token mode (-gnatyt), left paren must not be preceded by an -- identifier character or digit (a separating space is required) and may -- never be followed by a space. + -- Same applies for the left square bracket starting from Ada version 2022. - procedure Check_Left_Paren is + procedure Check_Left_Paren_Square_Bracket is begin if Style_Check_Tokens then if Token_Ptr > Source_First (Current_Source_File) @@ -740,7 +741,7 @@ package body Styleg is Check_No_Space_After; end if; - end Check_Left_Paren; + end Check_Left_Paren_Square_Bracket; --------------------------- -- Check_Line_Max_Length -- |