From c4487c3be84e0b892aeb61f30435638c6d94a8ab Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Wed, 3 Jul 2019 08:14:38 +0000 Subject: [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 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 --- gcc/ada/styleg.adb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/ada/styleg.adb') 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 -- ------------------- -- cgit v1.1