This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix missing style checks on entity name casing


This patch fixes some missed cases of checking proper spelling
(capitalization) of references to entities as follows:
Non overloaded enumeration literals
Parent package names in subunits
Field names in record component references
The following example, compiled with -gnatyaknpr shows four
messages that were previously missed.

     1. -- gnatmake -gnatyaknpr casing.adb
     2. procedure Casing is
     3.
     4.    package S is
     5.       type T is (abc, xyz);
     6.    end S;
     7.
     8.    package Sep is
     9.       type T is (Abc, Xyz);
    10.       function F return Boolean;
    11.    end Sep;
    12.
    13.    package body Sep is separate;
    14.
    15. begin
    16.    null;
    17. end Casing;

     1. separate (CASING)                              -- Casing
                   |
        >>> (style) bad casing of "Casing" declared at casing.adb:2

     2. package body Sep is
     3.    Global_Var : T := Abc;
     4.
     5.    type Record_Var_T is record
     6.       Field : Integer;
     7.    end record;
     8.
     9.    Record_Var : Record_Var_T;
    10.
    11.    function F return Boolean is
    12.    begin
    13.       Record_Var := Record_Var_T'(FIELD => 1); -- Field
                                           |
        >>> (style) bad casing of "Field" declared at line 6

    14.       case Global_Var is
    15.          when ABC =>                           -- Abc
                       |
        >>> (style) bad casing of "Abc" declared at casing.adb:9

    16.             return True;
    17.          when XYZ =>                           -- Xyz
                       |
        >>> (style) bad casing of "Xyz" declared at casing.adb:9

    18.             return False;
    19.       end case;
    20.    end F;
    21. end Sep;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-06-22  Robert Dewar  <dewar@adacore.com>

	* sem_aggr.adb (Resolve_Record_Aggregate): Do style check on component
	name.
	* sem_ch10.adb (Analyze_Subunit): Do style check on parent unit name.
	* sem_ch8.adb (Find_Direct_Name): For non-overloadable entities, do
	style check.
	* sem_res.adb (Resolve_Entity_Name): Do style check for enumeration
	literals.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]