Re: fixincludes needed on linux?

Bruce Korb (korb@datadesign.com)
Fri, 16 Oct 1998 11:02:48 -0700


Olivier Galibert wrote:

> The interesting ones:
>
> > --- /usr/include/rpc/types.h Fri Feb 17 21:34:09 1995
> > +++ include/rpc/types.h Thu Oct 15 08:07:35 1998
> > @@ -1,3 +1,7 @@
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > /* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */
> > /*
> > * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
> > @@ -76,3 +80,6 @@
> > #endif
> >
> > #endif /* _RPC_TYPES_H */
> > +#ifdef __cplusplus
> > +}
> > +#endif

This is a consequence of rogue OS'es having external procedures declaredin their
rpc/types.h file. It might be possible to select only those rpc/types.h
files that contain 'malloc *\(', but I cannot be certain. Consequently,
Zack Weinberg will insert a comment into the Linux version that will
cause the file to be skipped. (Thank you, again. :)

> > --- /usr/src/linux/include/linux/stddef.h Wed Dec 1 04:44:15 1993
> > +++ include/root/usr/src/linux/include/linux/stddef.h Thu Oct 15 08:08:02 1998
> > @@ -3,7 +3,10 @@
> >
> > #ifndef _SIZE_T
> > #define _SIZE_T
> > -typedef unsigned int size_t;
> > +#ifndef __SIZE_TYPE__
> > +#define __SIZE_TYPE__ long unsigned int
> > +#endif
> > +typedef __SIZE_TYPE__ size_t;
> > #endif
> >
> > #undef NULL

This is not 64-bit compliant, but then neither are several others of the
fixes.This particular fix coordinates with several other fixes throughout the
includes.
It would be good to find a proper fix.

> > --- /usr/include/stdio.h Wed May 29 01:39:51 1996
> > +++ include/stdio.h Thu Oct 15 08:07:45 1998
> > @@ -1,3 +1,5 @@
> > +#define __need___va_list
> > +#include <stdarg.h>
> > /* This is part of the iostream/stdio library, providing -*- C -*- I/O.
> > Define ANSI C stdio on top of C++ iostreams.
> > Copyright (C) 1991 Per Bothner.

It looks like this fix ought to be ignored whenever the stdio.h filedoes *not*
contain some variant of 'va_list'. Here is the complete fix
that causes the problem: /* * Don't use or define the name va_list in stdio.h.
* This is for ANSI and also to interoperate properly with gcc's varargs.h.
* Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
*/
fix = {
hackname = stdio_va_list;
files = stdio.h;

/*
* Use __gnuc_va_list in arg types in place of va_list.
* On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
* trailing parentheses and semicolon save all other systems from this.
* Define __va_list__ (something harmless and unused) instead of va_list.
* Don't claim to have defined va_list.
*/
shell =
"if ( egrep \"__need___va_list\" $file ) > /dev/null 2>&1 ; then
:
else
echo \"#define __need___va_list\"
echo \"#include <stdarg.h>\"
fi

sed -e 's@ va_list @ __gnuc_va_list @' \\
-e 's@ va_list)@ __gnuc_va_list)@' \\
-e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \\
-e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\
-e 's@ va_list@ __va_list__@' \\
-e 's@\\*va_list@*__va_list__@' \\
-e 's@ __va_list)@ __gnuc_va_list)@' \\
-e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\
-e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\
-e 's@VA_LIST@DUMMY_VA_LIST@' \\
-e 's@_Va_LIST@_VA_LIST@'";
};

I think two changes are appropriate:

1. add: test = '-n "egrep -i va_list $file"';

thus selecting only those files that use 'va_list'.

2. add: "-e 's@DUMMY_VA_LIST@VA_LIST@'"

It seems the next-to-last sed line would require this addition!!

--
Bruce Korb
Korb  at DataDesign dot com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/