I am experiencing a peculiar "info" message from GNAT 7.4.0 (running on an "Ubuntu 19.04" system) while in the early stages of developing a QR-code generator.
I'm using some fairly aggressive compilation switches:
gnatmake -gnata -gnateE -gnateF -gnatf -gnato -gnatv -gnatVa -gnaty -gnatwe -gnatw.e main.adb
My code does build without errors, but this info message does suggest that I'm not providing a body for the package "qr_symbol".
qr_symbol.ads
with QR_Versions; use QR_Versions;
generic
Ver : QR_Version;
package QR_Symbol is
procedure Export_As_SVG;
private
type Module_State is (
Uncommitted,
One,
Zero
);
type Module_Family is (
Uncommitted,
Finder,
Separator,
Alignment,
Timing,
Format_Spec,
Version_Spec,
Data_Codeword,
EC_Codeword,
Padding
);
type Module is
record
State : Module_State := Uncommitted;
Family : Module_Family := Uncommitted;
end record;
type Module_Matrix is array (
Positive range <>,
Positive range <>
) of Module;
end QR_Symbol;
qr_symbol.adb
with Ada.Text_IO; use Ada.Text_IO;
package body QR_Symbol is
Version : constant QR_Version := Ver; -- Ver is a formal generic parameter
Side_Length : constant Positive := 17 + (Positive (Ver) * 4);
Matrix : Module_Matrix (1 .. Side_Length, 1 .. Side_Length);
procedure Export_As_SVG is
begin
Put_Line ("in Export_As_SVG()...");
Put_Line (" Version: " & Version'Image);
Put_Line (" Side_Length: " & Side_Length'Image);
-- Matrix (1, 1).State := One;
Put_Line (" Matrix (1, 1).State: " & Matrix (1, 1).State'Image);
end Export_As_SVG;
end QR_Symbol;
And here's the info output that I do not understand...
GNAT 7.4.0
Copyright 1992-2017, Free Software Foundation, Inc.
Compiling: qr_symbol.adb
Source file time stamp: 2019-12-07 16:29:37
Compiled at: 2019-12-07 16:29:38
==============Error messages for source file: qr_symbol.ads
9. procedure Export_As_SVG;
|
>>> info: "QR_Symbol" requires body ("Export_As_SVG" requires completion)
29 lines: No errors, 1 info message
aarch64-linux-gnu-gnatbind-7 -x main.ali
aarch64-linux-gnu-gnatlink-7 main.ali
Program output (given correct input, does gives correct output)...
$ ./main '' V1
QR Version requested: V 1
in Export_As_SVG()...
Version: 1
Side_Length: 21
Matrix (1, 1).State: UNCOMMITTED
QUESTION: Why is there an info message suggesting that I need to provide a body for this package when it is clear that I have already done so?
An info message is not used to suggest that you should change your program, only to provide some (useful or not) information. In your case, the information is true. If it weren't fulfilled, it'd turn to an error.
You may want to check if this flag is causing the generation of this message:
According to GNAT User's Guide:
-gnatw.e `Activate every optional warning.'
This switch activates all optional warnings, including those which are not activated by -gnatwa. The use of this switch is not recommended for normal use. If you turn this switch on, it is almost certain that you will get large numbers of useless warnings. The warnings that are excluded from -gnatwa are typically highly specialized warnings that are suitable for use only in code that has been specifically designed according to specialized coding rules.
And if you don't want to remove that switch, at least you can disable this specific info message:
-gnatw.Y
`Disable information messages for why package spec needs body.'
This switch suppresses the output of information messages showing why a package specification needs a body.