diff options
author | Bob Duff <duff@adacore.com> | 2019-07-03 08:14:38 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-03 08:14:38 +0000 |
commit | c4487c3be84e0b892aeb61f30435638c6d94a8ab (patch) | |
tree | d92325f60a440a1745affa95115da988cb79db44 /gcc/ada/styleg.adb | |
parent | bf4f18bded58c7710276877ea8648b12ac3088be (diff) | |
download | gcc-c4487c3be84e0b892aeb61f30435638c6d94a8ab.zip gcc-c4487c3be84e0b892aeb61f30435638c6d94a8ab.tar.gz gcc-c4487c3be84e0b892aeb61f30435638c6d94a8ab.tar.bz2 |
[Ada] Style check for mixed-case identifiers
This patch implements a new switch, -gnatyD, enables a style check that
requires defining identifiers to be in mixed case.
2019-07-03 Bob Duff <duff@adacore.com>
gcc/ada/
* par-ch3.adb (P_Defining_Identifier): Call
Check_Defining_Identifier_Casing.
* style.ads, styleg.ads, styleg.adb
(Check_Defining_Identifier_Casing): New procedure to check for
mixed-case defining identifiers.
* stylesw.ads, stylesw.adb (Style_Check_Mixed_Case_Decls): New
flag for checking for mixed-case defining identifiers.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Document new feature.
* gnat_ugn.texi: Regenerate.
From-SVN: r272972
Diffstat (limited to 'gcc/ada/styleg.adb')
-rw-r--r-- | gcc/ada/styleg.adb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb index 56526d8..fc2364b 100644 --- a/gcc/ada/styleg.adb +++ b/gcc/ada/styleg.adb @@ -610,6 +610,27 @@ package body Styleg is end if; end Check_Comment; + -------------------------------------- + -- Check_Defining_Identifier_Casing -- + -------------------------------------- + + procedure Check_Defining_Identifier_Casing is + begin + if Style_Check_Mixed_Case_Decls then + case Determine_Token_Casing is + when All_Upper_Case | All_Lower_Case => + Error_Msg_SC -- CODEFIX + ("(style) bad capitalization, mixed case required"); + + -- The Unknown case is something like A_B_C, which is both all + -- caps and mixed case. + + when Mixed_Case | Unknown => + null; -- OK + end case; + end if; + end Check_Defining_Identifier_Casing; + ------------------- -- Check_Dot_Dot -- ------------------- |