lint and va_copy()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tim van der Molen
Date: Tuesday, December 28, 2010 - 4:59 pm

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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
lint and va_copy(), Tim van der Molen, (Tue Dec 28, 4:59 pm)
Re: lint and va_copy(), Ted Unangst, (Tue Dec 28, 6:30 pm)
Re: lint and va_copy(), Tim van der Molen, (Wed Dec 29, 8:53 am)
Re: lint and va_copy(), Philip Guenther, (Wed Dec 29, 11:26 am)