PERFORCE change 30885 for review

Peter Wemm peter at FreeBSD.org
Fri May 9 15:12:48 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=30885

Change 30885 by peter at peter_hammer on 2003/05/09 15:12:05

	Provide a fake stdarg implementation for lint's benefit so
	that it can see how it is supposed to work.  lint doesn't know
	that this is totally bogus though (and doesn't need to).

Affected files ...

.. //depot/projects/hammer/sys/amd64/include/_types.h#4 edit
.. //depot/projects/hammer/sys/amd64/include/stdarg.h#3 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/include/_types.h#4 (text+ko) ====

@@ -96,7 +96,11 @@
 /*
  * Unusual type definitions.
  */
+#if defined(__GNUC__)
 typedef	__builtin_va_list	__va_list;	/* internally known to gcc */
+#elif defined(lint)
+typedef	char *			__va_list;	/* pretend */
+#endif
 #if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
 #define	__GNUC_VA_LIST
 typedef	__va_list	__gnuc_va_list;		/* compatibility w/GNU headers*/

==== //depot/projects/hammer/sys/amd64/include/stdarg.h#3 (text+ko) ====

@@ -39,6 +39,7 @@
 typedef	__va_list	va_list;
 #endif
 
+#if defined(__GNUC__)
 #define	va_start(ap, last) \
 	__builtin_stdarg_start((ap), (last))
 
@@ -53,4 +54,16 @@
 #define	va_end(ap) \
 	__builtin_va_end(ap)
 
+#elif defined(lint)
+/* Provide a fake implementation for lint's benefit */
+#define	__va_size(type) \
+	(((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
+#define	va_start(ap, last) \
+	((ap) = (va_list)&(last) + __va_size(last))
+#define	va_arg(ap, type) \
+	(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
+#define	va_end(ap)
+
+#endif
+
 #endif /* !_MACHINE_STDARG_H_ */


More information about the p4-projects mailing list