lint currently does not properly handle va_copy(): a statement like
"va_copy(ap2, ap);" causes lint to issue warnings like

test.c:14: warning: ap2 may be used before set
Lint pass2:
test.c:14: __va_copy used, but not defined

Defining the following macro would be sufficient to prevent these
warnings:

#define va_copy(dst, src)       ((dst) = (src))

Because most of the /usr/src/sys/arch/*/include/stdarg.h headers contain
an "#ifdef lint" block, it seems appropriate to add the above macro to
these blocks.

Unfortunately, <stdarg.h> defines va_copy(), too:

#if __ISO_C_VISIBLE >= 1999
#define va_copy(dst, src)       __va_copy((dst), (src))
#endif

This could be solved, however, by hiding this macro from lint. For
example:

#if (defined(__GNUC__) || defined(__PCC__)) && __ISO_C_VISIBLE >= 1999
#define va_copy(dst, src)       __va_copy((dst), (src))
#endif

Perhaps this change would be sensible also because __va_copy() is an
extension to standard C.

So, to conclude, what I would like to propose is the following:
* Hide from lint the va_copy() macro in <stdarg.h>.
* Add a lint-friendly va_copy() macro to
  /usr/src/sys/arch/*/include/stdarg.h.

Any thoughts?

Regards,
Tim

Reply via email to