On 11/9/06,
Ulf Lamping <
ulf.lamping@xxxxxx> wrote:
LEGO wrote:
> what about #defining them so they trigger an error?
>
Although this would be a nice solution, I don't see a way to do this -
it will conflict with the existing function declarations IMHO.
I think it depends on what kind of symbol you have. You have three different situations:
1. Normal functions. With gcc, you can use
__attribute__((__deprecated__)), which gives you a warning every time
you call that function. Obviously you cannot use this solution for
other compilers. You can also use a macro to generate an error (but you
may get name space problems, as always with macros).
2. If you have a macro, such as htol(), you can just use #undef after the system header files are included.
3. If you have a macro definition where you would expect a function, it
does get tricky. Maybe you can check whether a macro is defined, and
use conditional code according to the result.
Finally you could check your object files for unresolved symbol
references, but this can be misleading if macro tricks are played.
If you have some consensus on the preference, I could try to work on a
solution. Having a separate "check" target that only works with gcc
should be doable. Finding a solution that works on every supported
platform is a lot more difficult.
Thomas