2.1.90 swab.h warnings

Werner Almesberger (almesber@lrc.di.epfl.ch)
Wed, 18 Mar 1998 21:10:42 +0100 (MET)


There's a little problem in 2.1.90 (as well as in older kernels - I had this
already in 2.1.79) if programs are compiled with -Wmissing-prototypes on a
libc5-based system and they #include <netinet/in.h>:

The swap inline functions in linux/include/byteorder/swab.h don't have
prototypes, so gcc (2.7.2.1 in my case) complains. I've attached a patch
that fixes the warnings.

I never took the time to understand the exact rules for inline function
declarations, so this may be a sub-optimal approach. Could someone please
check it and then pass it on to Linus ? Thanks !

- Werner

---------------------------------- cut here -----------------------------------

--- include/linux/byteorder/swab.h.orig Wed Mar 18 22:14:20 1998
+++ include/linux/byteorder/swab.h Wed Mar 18 22:14:22 1998
@@ -93,33 +93,40 @@
#endif /* OPTIMIZE */


+extern __inline__ __const__ __u16 __fswab16(__u16 x);
extern __inline__ __const__ __u16 __fswab16(__u16 x)
{
return __arch__swab16(x);
}
+extern __inline__ __u16 __swab16p(__u16 *x);
extern __inline__ __u16 __swab16p(__u16 *x)
{
return __arch__swab16p(x);
}
+extern __inline__ void __swab16s(__u16 *addr);
extern __inline__ void __swab16s(__u16 *addr)
{
__arch__swab16s(addr);
}

+extern __inline__ __const__ __u32 __fswab32(__u32 x);
extern __inline__ __const__ __u32 __fswab32(__u32 x)
{
return __arch__swab32(x);
}
+extern __inline__ __u32 __swab32p(__u32 *x);
extern __inline__ __u32 __swab32p(__u32 *x)
{
return __arch__swab32p(x);
}
+extern __inline__ void __swab32s(__u32 *addr);
extern __inline__ void __swab32s(__u32 *addr)
{
__arch__swab32s(addr);
}

#ifdef __BYTEORDER_HAS_U64__
+extern __inline__ __const__ __u64 __fswab64(__u64 x);
extern __inline__ __const__ __u64 __fswab64(__u64 x)
{
# ifdef __SWAB_64_THRU_32__
@@ -130,10 +137,12 @@
return __arch__swab64(x);
# endif
}
+extern __inline__ __u64 __swab64p(__u64 *x);
extern __inline__ __u64 __swab64p(__u64 *x)
{
return __arch__swab64p(x);
}
+extern __inline__ void __swab64s(__u64 *addr);
extern __inline__ void __swab64s(__u64 *addr)
{
__arch__swab64s(addr);

-- 
  _________________________________________________________________________
 / Werner Almesberger, DI-ICA,EPFL,CH   werner.almesberger@lrc.di.epfl.ch /
/_IN_R_131__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu