This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Query on Warning 16

if I get a Warning 16 during Liking, does it necessaily mean that my function isnt being called(could it be possible that the function is being called indirectly). Can i remove the function from my source?

Is warning 16 related in any way to Warning 15 or any other Warnings.

Parents
  • The warning means that the function is not called, even indirectly*. The major concern behind this warning message is that this function's local variables are using up precious ram space. Is is best that the function is removed. The second best is to place a dummy call to the function in your main(so the overlayer can do its magic).

    It is a real pain that this function is not removed automatically, but what is, is.


    *I assume you did not locate this particular function at some absolute address.

Reply
  • The warning means that the function is not called, even indirectly*. The major concern behind this warning message is that this function's local variables are using up precious ram space. Is is best that the function is removed. The second best is to place a dummy call to the function in your main(so the overlayer can do its magic).

    It is a real pain that this function is not removed automatically, but what is, is.


    *I assume you did not locate this particular function at some absolute address.

Children
  • "The warning means that the function is not called, even indirectly"

    I don't think that's entirely true; I think that the linker can detect some (maybe even most?) indirect calls, but can't guarantee to detect all indirect calls.
    Therefore, I think it is possible that the functions may actually get used somehow.

    But I could be wrong ...

  • Think about it. To access a relocatable function(whether to call it, or to save a pointer to it, or ... ), the linker must have a reference to that access, so it can fixup that address. So logically the converse must be true. That being, if there is no references to a relocatable function, there is no access to it.

    Would it not be great if the linker had a "remove all unreferenced relocatable functions" option? We could get rid of all of this warning 16 nonsense. We could get rid of all of this one function per file to make a library nonsense. We could leave in debugging support routines, knowing they would be removed when unused. We could test just part of our code by just commenting out calls to functions we did not want to test.

    This seems like such a simple option to add to the linker, for such great benefits. I just do not know why it is not done.