The classic lint program was used for very problematic functions that returned a value that was ignored. The problem was that many of these warnings were undesirable - leading to excessive noise in the output stream (it was collecting pieces of fluff that you wanted it to ignore). This is probably why GCC does not have a standard warning for it.
Another problem - the flip side - is "how do you suppress the warning when you know that you are ignoring the result, but actually itβs all the same." The classic script for this:
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) signal(SIGHUP, sighandler);
You care about the first result from signal() ; you know that the second will be SIG_IGN (since you just set it). To get away from warnings, I sometimes use some option:
if ((old = signal(SIGHUP, SIG_IGN)) != SIG_IGN) old = signal(SIGHUP, sighandler);
This assigns old both times. You can follow this with "assert (old == SIG_IGN)".
Jonathan Leffler Jan 11 '10 at 16:48 2010-01-11 16:48
source share