Dubious "'foo' might be used uninitialized in this function" message

Florian Weimer fw@deneb.enyo.de
Wed Dec 15 17:33:00 GMT 2004


* 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.



More information about the Gcc mailing list