Skip to content

Commit 5ea0322

Browse files
committed
Merge branch 'topic/message_tags' into 'master'
Add tags to all GNATcheck messages Closes #308 See merge request eng/libadalang/langkit-query-language!331
2 parents ee4cc46 + c9ce1f8 commit 5ea0322

File tree

52 files changed

+732
-605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+732
-605
lines changed

lkql_checker/src/gnatcheck-compiler.adb

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ package body Gnatcheck.Compiler is
280280

281281
procedure Format_Error is
282282
begin
283-
Error ("Unparsable line: " & Msg);
283+
Error ("unparsable worker output: """ & Msg & """");
284284
Errors := True;
285285
end Format_Error;
286286

@@ -451,12 +451,12 @@ package body Gnatcheck.Compiler is
451451
-- them.
452452

453453
if Is_Regular_File (Out_File) and then Size (Out_File) /= 0 then
454-
Error ("error when calling gprbuild:");
454+
Error ("error when calling gprbuild, raw output:");
455455

456456
declare
457457
Str : String_Access := Read_File (Out_File);
458458
begin
459-
Error_No_Tool_Name (Str (Str'First .. Str'Last - 1));
459+
Print (Str (Str'First .. Str'Last - 1));
460460
Free (Str);
461461
end;
462462

@@ -474,7 +474,7 @@ package body Gnatcheck.Compiler is
474474
and then Line (1 .. 29) = "gnat1: invalid switch: -gnatw")
475475
then
476476
Error ("wrong parameter specified for compiler-related rule:");
477-
Error_No_Tool_Name (Line (1 .. Line_Len));
477+
Print (Line (1 .. Line_Len));
478478
Errors := True;
479479

480480
elsif Index (Line (1 .. Line_Len), "BUG DETECTED") /= 0 then
@@ -1070,8 +1070,9 @@ package body Gnatcheck.Compiler is
10701070
(Lower_Rest_Name, I_Name, Cursor, Success);
10711071
if not Success and then Restriction_To_Instance (Cursor) /= I_Name
10721072
then
1073-
Error ("cannot enable the same restriction in different rule " &
1074-
"instances : " & Rest_Name);
1073+
Error
1074+
("cannot enable the same restriction in different rule "
1075+
& "instances: " & Rest_Name);
10751076
Bad_Rule_Detected := True;
10761077
return;
10771078
end if;
@@ -1087,8 +1088,9 @@ package body Gnatcheck.Compiler is
10871088
exit;
10881089

10891090
else
1090-
Error ("wrong structure of restriction rule parameter " &
1091-
Param & ", ignored");
1091+
Error
1092+
("wrong structure of restriction rule parameter " & Param
1093+
& ", ignored");
10921094
Bad_Rule_Detected := True;
10931095

10941096
return;
@@ -1099,8 +1101,9 @@ package body Gnatcheck.Compiler is
10991101
if R_Id in All_Boolean_Restrictions then
11001102

11011103
if Arg_Present then
1102-
Error ("RESTRICTIONS rule parameter: " & Param &
1103-
" can not contain expression, ignored");
1104+
Error
1105+
("RESTRICTIONS rule parameter: " & Param
1106+
& " can not contain expression, ignored");
11041107
Bad_Rule_Detected := True;
11051108
else
11061109
Restriction_Setting (R_Id).Active := True;
@@ -1109,8 +1112,9 @@ package body Gnatcheck.Compiler is
11091112
elsif R_Id /= Not_A_Restriction_Id then
11101113

11111114
if not Arg_Present then
1112-
Error ("RESTRICTIONS rule parameter: " & Param &
1113-
" should contain an expression, ignored");
1115+
Error
1116+
("RESTRICTIONS rule parameter: " & Param
1117+
& " should contain an expression, ignored");
11141118
Bad_Rule_Detected := True;
11151119

11161120
return;
@@ -1134,17 +1138,19 @@ package body Gnatcheck.Compiler is
11341138
end if;
11351139
end loop;
11361140

1137-
Error ("expression for RESTRICTIONS rule parameter: " &
1138-
Param (First_Idx .. Last_Idx) &
1139-
" is specified more than once");
1141+
Error
1142+
("expression for RESTRICTIONS rule parameter: "
1143+
& Param (First_Idx .. Last_Idx)
1144+
& " is specified more than once");
11401145
Rule_Option_Problem_Detected := True;
11411146
end if;
11421147

11431148
Restriction_Setting (R_Id).Param.Append (R_Val'Img);
11441149
exception
11451150
when Constraint_Error =>
1146-
Error ("wrong restriction parameter expression in " &
1147-
Param & ", ignored");
1151+
Error
1152+
("wrong restriction parameter expression in "
1153+
& Param & ", ignored");
11481154
Bad_Rule_Detected := True;
11491155

11501156
return;
@@ -1167,8 +1173,9 @@ package body Gnatcheck.Compiler is
11671173
case Special_R_Id is
11681174
when No_Dependence =>
11691175
if not Arg_Present then
1170-
Error ("Restrictions rule parameter: " & Param &
1171-
" should contain a unit name, ignored");
1176+
Error
1177+
("Restrictions rule parameter: " & Param
1178+
& " should contain a unit name, ignored");
11721179
Bad_Rule_Detected := True;
11731180

11741181
return;
@@ -1180,8 +1187,9 @@ package body Gnatcheck.Compiler is
11801187

11811188
when No_Use_Of_Entity =>
11821189
if not Arg_Present then
1183-
Error ("Restrictions rule parameter: " & Param &
1184-
" should contain an entity name, ignored");
1190+
Error
1191+
("Restrictions rule parameter: " & Param
1192+
& " should contain an entity name, ignored");
11851193
Bad_Rule_Detected := True;
11861194

11871195
return;
@@ -1193,8 +1201,9 @@ package body Gnatcheck.Compiler is
11931201

11941202
when No_Specification_Of_Aspect =>
11951203
if not Arg_Present then
1196-
Error ("Restrictions rule parameter: " & Param &
1197-
" should contain an aspect name, ignored");
1204+
Error
1205+
("Restrictions rule parameter: " & Param
1206+
& " should contain an aspect name, ignored");
11981207
Bad_Rule_Detected := True;
11991208

12001209
return;
@@ -1226,8 +1235,9 @@ package body Gnatcheck.Compiler is
12261235
Static_Dispatch_Tables |
12271236
No_Exception_Propagation
12281237
then
1229-
Warning ("restriction " & To_Mixed (R_Id'Img) &
1230-
" ignored - only fully effective during code generation");
1238+
Warning
1239+
("restriction " & To_Mixed (R_Id'Img)
1240+
& " ignored - only fully effective during code generation");
12311241

12321242
Restriction_Setting (R_Id).Active := False;
12331243
end if;
@@ -1243,20 +1253,23 @@ package body Gnatcheck.Compiler is
12431253
No_Entry_Queue |
12441254
No_Reentrancy
12451255
then
1246-
Warning ("restriction " & To_Mixed (R_Id'Img) &
1247-
" ignored - cannot be checked statically");
1256+
Warning
1257+
("restriction " & To_Mixed (R_Id'Img)
1258+
& " ignored - cannot be checked statically");
12481259

12491260
Restriction_Setting (R_Id).Active := False;
12501261

12511262
elsif R_Id = No_Recursion then
1252-
Warning ("restriction No_Recursion ignored (cannot be checked " &
1253-
"statically), use rule Recursive_Subprograms instead");
1263+
Warning
1264+
("restriction No_Recursion ignored (cannot be checked statically), "
1265+
& "use rule Recursive_Subprograms instead");
12541266

12551267
Restriction_Setting (R_Id).Active := False;
12561268

12571269
elsif R_Id = Max_Asynchronous_Select_Nesting and then R_Val /= 0 then
1258-
Warning ("restriction Max_Asynchronous_Select_Nesting ignored - " &
1259-
"cannot be checked statically if parameter is not 0");
1270+
Warning
1271+
("restriction Max_Asynchronous_Select_Nesting ignored - "
1272+
& "cannot be checked statically if parameter is not 0");
12601273
Restriction_Setting (R_Id).Active := False;
12611274
end if;
12621275
end Process_Restriction_Param;
@@ -1320,8 +1333,9 @@ package body Gnatcheck.Compiler is
13201333

13211334
Style_To_Instance.Insert ([C], Name, Cursor, Success);
13221335
if not Success and then Style_To_Instance (Cursor) /= Name then
1323-
Error ("cannot enable the same style check in different " &
1324-
"rule instances : " & C);
1336+
Error
1337+
("cannot enable the same style check in different rule "
1338+
& "instances: " & C);
13251339
Bad_Rule_Detected := True;
13261340
return;
13271341
end if;
@@ -1395,8 +1409,9 @@ package body Gnatcheck.Compiler is
13951409
if Param (J) in 'e' | 's'
13961410
and then (J = Param'First or else Param (J - 1) not in '.' | '_')
13971411
then
1398-
Error ("Warnings rule cannot have " & Param (J) &
1399-
" parameter, parameter string " & Param & " ignored");
1412+
Error
1413+
("Warnings rule cannot have " & Param (J)
1414+
& " parameter, parameter string " & Param & " ignored");
14001415
Bad_Rule_Detected := True;
14011416

14021417
return;
@@ -1416,8 +1431,9 @@ package body Gnatcheck.Compiler is
14161431

14171432
Warning_To_Instance.Insert (Param (I .. J), Name, Cursor, Success);
14181433
if not Success and then Warning_To_Instance (Cursor) /= Name then
1419-
Error ("cannot enable the same warning in different rule " &
1420-
"instances : " & Param (I .. J));
1434+
Error
1435+
("cannot enable the same warning in different rule instances: "
1436+
& Param (I .. J));
14211437
Bad_Rule_Detected := True;
14221438
return;
14231439
end if;
@@ -1595,8 +1611,8 @@ package body Gnatcheck.Compiler is
15951611

15961612
-- Test if the worker executable exists
15971613
if Worker = null then
1598-
Error ("cannot locate the worker executable: "
1599-
& Base_Name (Worker_Name));
1614+
Error
1615+
("cannot locate the worker executable: " & Base_Name (Worker_Name));
16001616
raise Fatal_Error;
16011617
end if;
16021618

@@ -1718,8 +1734,9 @@ package body Gnatcheck.Compiler is
17181734
end loop;
17191735

17201736
if Worker = null then
1721-
Error ("cannot locate the worker executable: "
1722-
& Base_Name (Worker_Name));
1737+
Error
1738+
("cannot locate the worker executable: "
1739+
& Base_Name (Worker_Name));
17231740
raise Fatal_Error;
17241741
end if;
17251742

lkql_checker/src/gnatcheck-diagnoses.adb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -751,17 +751,18 @@ package body Gnatcheck.Diagnoses is
751751
when E : others =>
752752

753753
Report_EOL;
754-
Report ("cannot successfully copy information " &
755-
"from " & User_Info_File.all);
754+
Report
755+
("cannot successfully copy information from " & User_Info_File.all);
756756

757757
if Is_Open (User_File) then
758758
Close (User_File);
759759
end if;
760760

761-
Error ("cannot copy information from " & User_Info_File.all &
762-
" into report file");
761+
Error
762+
("cannot copy information from " & User_Info_File.all
763+
& " into report file");
763764

764-
Error_No_Tool_Name (Ada.Exceptions.Exception_Information (E));
765+
Print (Ada.Exceptions.Exception_Information (E));
765766
end Copy_User_Info;
766767

767768
----------------
@@ -1717,17 +1718,17 @@ package body Gnatcheck.Diagnoses is
17171718
Diagnoses_Reported >= Max_Diagnoses
17181719
then
17191720
Limit_Exceeded := True;
1720-
Info ("Maximum diagnoses reached, " &
1721-
"see the report file for full details");
1721+
Info
1722+
("maximum diagnoses reached, see the report file for full "
1723+
& "details");
17221724
else
17231725
if Error_Messages_Storage.Element (Position).Justification
17241726
= Null_Unbounded_String
17251727
then
17261728
Diagnoses_Reported := @ + 1;
1727-
Info
1729+
Print
17281730
(Preprocess_Diag
1729-
(Image
1730-
(Error_Messages_Storage.Element (Position))));
1731+
(Image (Error_Messages_Storage.Element (Position))));
17311732
end if;
17321733
end if;
17331734
end if;

0 commit comments

Comments
 (0)