Hello, Is there a way to avoid the following warning: Warning L16: uncalled segment, ignored for overlay process? I'm not talking about the Disable warning numbers you have in the options of a project... I know what the overlay process does, but if the function is indeed not called (and there could be reasons not to call a function for a certain application), is there not a kind of 'dead code remover' who can check if a function is called or not? If so, is this function not able to inform the compiler just to ignore this function and not to generate the warning? Rgds, Geert
For this I wrote a simple program that scans L51 listing for warnings 16. If there are warnings 16, it writes out an overlay description that binds all unreferenced segments (warning 16) to main, like this: OVERLAY( main ! (seg1,seg2,etc)) Then I re-link with this overlay directive - no more warnings. My app also generates some warnings 15 (multiple called segment) that actually should be ignored. So my program searches for these as well, and excludes from overlaying by OVERLAY( segname !*) Fast, dirty, practical :) P.S. - I made this thingie in the dark days of C51 v 3.20 - may be modern linkers have some new controls for this.
"Each object in the library should contain exactly one function." This requirement is a bit restrictive in practice. Normal C code will contain many functions in a .c file, and thus the corresponding object. Building a library then won't help, since if you include _any_ function from a single object, you'll get the warnings for all the other functions you didn't want from that object. The only way to avoid it is to break every function into its own file, which is a bit nightmarish from an organizational point of view, particularly when several functions share data or helper routines that don't need to be externally visible. The toolchain should be smart enough to pull in only those functions you actually call from a library. It would also be good if the linker could eliminate unreferenced functions from an object, even if it's not a library. Every other compiler I've used supports this functionality.
Every other compiler I've used supports this functionality. Really? Are you certain about that? I don't know of a linker that will break objects apart. Jon