Ada-关于软件包主体要求的令人困惑的“ info”消息

问题描述 投票:0回答:1

在开发QR码生成器的早期阶段,我正在从GNAT 7.4.0(在“ Ubuntu 19.04”系统上运行)收到特殊的“信息”消息。

我正在使用一些相当激进的编译开关:

gnatmake -gnata -gnateE -gnateF -gnatf -gnato -gnatv -gnatVa -gnaty -gnatwe -gnatw.e main.adb

我的代码的构建确实没有错误,但是此信息消息确实表明我没有为程序包“ 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;

这是我不理解的信息输出...

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

程序输出(输入正确,输出正确)...

$ ./main '' V1
QR Version requested: V 1
in Export_As_SVG()...
  Version:  1
  Side_Length:  21
  Matrix (1, 1).State: UNCOMMITTED

问题:显然我已经这样做了,为什么会有一条信息消息提示我需要为此程序包提供一个正文?

linux compiler-warnings ada ada2012
1个回答
3
投票

信息消息不是用来建议您更改程序,而只是提供一些(有用或不有用)信息。就您而言,信息是真实的。如果未实现,则会出现错误。

您可能要检查此标志是否导致生成此消息:

根据GNAT User's Guide

-gnatw.e`激活每个可选警告。'

此开关将激活所有可选警告,包括-gnatwa未激活的警告。不使用此开关建议正常使用。如果您打开此开关,几乎确定您会收到大量无用的警告。的-gnatwa中排除的警告通常非常严重仅适用于具有以下内容的代码的专门警告是根据专门的编码规则专门设计的。

并且如果您不想删除该开关,至少可以禁用此特定的信息消息:

-gnatw.Y

`禁用有关为什么包装规范需要正文的信息。

此开关禁止显示表示为什么包装规格需要正文的信息消息。

© www.soinside.com 2019 - 2024. All rights reserved.