Dubious "'foo' might be used uninitialized in this function" message
Robert Dewar
dewar@adacore.com
Wed Dec 15 17:34:00 GMT 2004
Florian Weimer wrote:
> * Robert Dewar:
>
>
>>Here is an example from Ada:
>>
>> 1. generic
>> 2. type R is private;
>> |
>> >>> warning: type "R" is not referenced
>>
>> 3. package Q is
>> 4. X : Integer;
>> 5. end Q;
>>
>>One of our customers recently complained that this was a false
>>positive, because there might be a child unit of Q that references
>>R. This is true. However, after quite a bit of dicussion, we
>>decided that it was useful to retain the warning, since it is
>>rather unusual (though certainly legal) to have entities that
>>are referenced ONLY in a child unit, and if we removed the
>>warning on this basis, we would lose a lot of useful warnings.
>
>
> In this case, pragma Unreferenced could be specified in the body of
> the parant unit, and it could do the right thing.
first of all, there is no body of the parent unit in this case. Second
of all, pragma Unreferenced means you have something that is not
referenced anywhere. So this does not help in this case. Indeed the
"bug" report was precisely that pragma unreferenced does not work :-)
More information about the Gcc
mailing list