@@ -99,7 +99,7 @@ package body Gnatcheck.Projects is
99
99
(Self : Gnatcheck_Reporter) return GPR2.Reporter.Verbosity_Level;
100
100
101
101
Gpr2_Reporter : Gnatcheck_Reporter;
102
- -- Make libgpt2 report messages using the proper gnatcheck .Output API
102
+ -- Make libgpr2 report messages using the proper ``Gnatcheck .Output`` API.
103
103
104
104
function Report_Missing_File (Log : String) return Boolean
105
105
is (Index (Log, " source file" ) /= 0 and then Index (Log, " not found" ) /= 0 );
@@ -1056,7 +1056,7 @@ package body Gnatcheck.Projects is
1056
1056
-- Process_Rule_Options --
1057
1057
-- ------------------------
1058
1058
1059
- type Option_Kind is (File, Option );
1059
+ type Option_Kind is (File, Legacy_Option, Single_Rule_Name );
1060
1060
1061
1061
type Option_Record is record
1062
1062
Kind : Option_Kind;
@@ -1080,43 +1080,53 @@ package body Gnatcheck.Projects is
1080
1080
for O of Rule_Options loop
1081
1081
case O.Kind is
1082
1082
when File =>
1083
- Process_Rule_File (To_String (O.Value));
1083
+ Process_Legacy_Rule_File (To_String (O.Value));
1084
1084
1085
- when Option =>
1086
- Process_Rule_Option (To_String (O.Value), Defined_At => " " );
1085
+ when Legacy_Option =>
1086
+ Process_Legacy_Rule_Option
1087
+ (To_String (O.Value), Defined_At => " " );
1088
+
1089
+ when Single_Rule_Name =>
1090
+ Process_Single_Rule_Name (To_String (O.Value));
1087
1091
end case ;
1088
1092
end loop ;
1089
1093
Process_Compiler_Instances;
1090
1094
end Process_Rule_Options ;
1091
1095
1092
- -- -------------------
1093
- -- Add_Rule_Option --
1094
- -- -------------------
1096
+ -- --------------------------
1097
+ -- Add_Legacy_Rule_Option --
1098
+ -- --------------------------
1095
1099
1096
- procedure Add_Rule_Option (Opt : String; Prepend : Boolean := False) is
1100
+ procedure Add_Legacy_Rule_Option (Opt : String; Prepend : Boolean := False)
1101
+ is
1097
1102
use Ada.Strings.Unbounded;
1098
1103
1099
1104
Opt_Rec : constant Option_Record :=
1100
- (Option , To_Unbounded_String (Trim (Opt, Both)));
1105
+ (Legacy_Option , To_Unbounded_String (Trim (Opt, Both)));
1101
1106
begin
1102
1107
if Prepend then
1103
1108
Rule_Options.Prepend (Opt_Rec);
1104
1109
else
1105
1110
Rule_Options.Append (Opt_Rec);
1106
1111
end if ;
1107
- end Add_Rule_Option ;
1112
+ end Add_Legacy_Rule_Option ;
1108
1113
1109
1114
-- --------------------
1110
1115
-- Add_Rule_By_Name --
1111
1116
-- --------------------
1112
1117
1113
1118
procedure Add_Rule_By_Name (Rule_Name : String; Prepend : Boolean := False)
1114
1119
is
1115
- Lower_Rule : constant String := To_Lower (Rule_Name);
1116
- Prefix : constant String :=
1117
- (if Lower_Rule = " all" then " +" else " +R" );
1120
+ use Ada.Strings.Unbounded;
1121
+
1122
+ Opt_Rec : constant Option_Record :=
1123
+ (Single_Rule_Name, To_Unbounded_String (Trim (Rule_Name, Both)));
1118
1124
begin
1119
- Add_Rule_Option (Prefix & Lower_Rule, Prepend => Prepend);
1125
+ if Prepend then
1126
+ Rule_Options.Prepend (Opt_Rec);
1127
+ else
1128
+ Rule_Options.Append (Opt_Rec);
1129
+ end if ;
1120
1130
end Add_Rule_By_Name ;
1121
1131
1122
1132
-- ----------------------
@@ -1225,16 +1235,16 @@ package body Gnatcheck.Projects is
1225
1235
(Option_Record'
1226
1236
(File,
1227
1237
To_Unbounded_String (Parameter (Parser => Parser))));
1228
- if not More_Then_One_Rule_File_Set then
1229
- Rule_File_Name :=
1238
+ if not More_Than_One_Legacy_Rule_File_Set then
1239
+ Legacy_Rule_File_Name :=
1230
1240
new String'(Parameter (Parser => Parser));
1231
- More_Then_One_Rule_File_Set := True;
1241
+ More_Than_One_Legacy_Rule_File_Set := True;
1232
1242
else
1233
- Free (Rule_File_Name );
1243
+ Free (Legacy_Rule_File_Name );
1234
1244
end if ;
1235
1245
1236
1246
when others =>
1237
- Add_Rule_Option (Full_Switch (Parser => Parser));
1247
+ Add_Legacy_Rule_Option (Full_Switch (Parser => Parser));
1238
1248
Individual_Rules_Set := True;
1239
1249
end case ;
1240
1250
if not Rules_Depreciation_Emitted then
0 commit comments