This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 :-)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]