aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/style.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-01-29 15:17:44 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2013-01-29 15:17:44 +0100
commit54bb89caeab2b2ce71f935e2f290fa1402942529 (patch)
tree850467042bd51bffbc744a59d1dd82611e2d195f /gcc/ada/style.adb
parent2808600b9f513ee8d428823cd1726a0d5fed004c (diff)
downloadgcc-54bb89caeab2b2ce71f935e2f290fa1402942529.zip
gcc-54bb89caeab2b2ce71f935e2f290fa1402942529.tar.gz
gcc-54bb89caeab2b2ce71f935e2f290fa1402942529.tar.bz2
[multiple changes]
2013-01-29 Robert Dewar <dewar@adacore.com> * a-calend-vms.adb: Minor comment fix. 2013-01-29 Robert Dewar <dewar@adacore.com> * mlib-utl.adb, gnatlink.adb: Avoid reference to ASCII.Back_Slash because of casing issues. * sem_util.ads: Minor comment fix. * style.adb (Check_Identifier): Set proper casing for entities in ASCII. * styleg.adb: Minor comment improvement. * stylesw.ads (Style_Check_Standard): Fix bad comments. 2013-01-29 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb: Add the grammar for pragmas Abstract_State and Global. (Analyze_Pragma): Push the scope of the related subprogram and install its formals once before starting the analysis of the [moded] global list. 2013-01-29 Pascal Obry <obry@adacore.com> * prj-proc.adb (Process_Expression_Variable_Decl): Always handle relative paths in Project_Path as relative to the aggregate project location. Note that this was what was documented. 2013-01-29 Vincent Celier <celier@adacore.com> * gnatcmd.adb: For "gnat stub -P ...", do not check the naming scheme for Ada, when Ada is not a language for the project. From-SVN: r195539
Diffstat (limited to 'gcc/ada/style.adb')
-rw-r--r--gcc/ada/style.adb30
1 files changed, 26 insertions, 4 deletions
diff --git a/gcc/ada/style.adb b/gcc/ada/style.adb
index fd86659..b07e223 100644
--- a/gcc/ada/style.adb
+++ b/gcc/ada/style.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -94,7 +94,9 @@ package body Style is
----------------------
-- In check references mode (-gnatyr), identifier uses must be cased
- -- the same way as the corresponding identifier declaration.
+ -- the same way as the corresponding identifier declaration. If standard
+ -- references are checked (-gnatyn), then identifiers from Standard must
+ -- be cased as in the Reference Manual.
procedure Check_Identifier
(Ref : Node_Or_Entity_Id;
@@ -197,10 +199,30 @@ package body Style is
if Entity (Ref) = Standard_ASCII then
Cas := All_Upper_Case;
- -- Special names in ASCII are also all upper case
+ -- Special handling for names in package ASCII
elsif Sdef = Standard_ASCII_Location then
- Cas := All_Upper_Case;
+ declare
+ Nam : constant String := Get_Name_String (Chars (Def));
+
+ begin
+ -- Bar is mixed case
+
+ if Nam = "bar" then
+ Cas := Mixed_Case;
+
+ -- All names longer than 4 characters are mixed case
+
+ elsif Nam'Length > 4 then
+ Cas := Mixed_Case;
+
+ -- All names shorter than 4 characters (other than Bar,
+ -- which we already tested for specially) are Upper case.
+
+ else
+ Cas := All_Upper_Case;
+ end if;
+ end;
-- All other entities are in mixed case