GNAT warns about primitive operations appearing too late in the text.
In the following example, though, F is not meant to be a primitive
operation of A.Some_Tagged, but instead one of type B.Plain.
Can I ignore the warning?
gcc -gnatl -c rt_warn.ads
GNAT 11.2.0
Copyright 1992-2021, Free Software Foundation, Inc.
cannot generate code for file rt_warn.ads (package spec)
Compiling: rt_warn.ads
Source file time stamp: 2022-07-10 08:34:32
Compiled at: 2022-07-10 10:34:39
1. package Rt_Warn is
2.
3. package A is
4.
5. type Some_Tagged is interface;
6.
7. end A;
8.
9. package B is
10.
11. type Plain is private;
12.
13. function F (Param : A.Some_Tagged) return Plain;
|
>>> warning: declaration of "F" is too late
>>> warning: spec should appear immediately after declaration of "Some_Tagged"
GNAT warns about primitive operations appearing too late in the text.
In the following example, though, F is not meant to be a primitive
operation of A.Some_Tagged, but instead one of type B.Plain.
Can I ignore the warning?
Since B.F is declared in a sibling package, it cannot a primitive of A.Some_Tagged, so the error message is wrong.
Since A.Some_Tagged is an interface, you can only declare abstract
primitive subprograms for it. So I suspect GNAT knows there's an error, but is
giving a confusing error message.
How are you intending F to be different from FC?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 402 |
Nodes: | 16 (2 / 14) |
Uptime: | 19:07:38 |
Calls: | 8,394 |
Calls today: | 2 |
Files: | 13,168 |
Messages: | 5,902,655 |