[PATCH] 2.4.21-rc1: byteorder.h breaks with __STRICT_ANSI__ defined

Thomas Horsten (thomas@horsten.com)
Tue, 6 May 2003 12:24:39 +0200 (CEST)


Hi Marcelo,

Here is a patch to fix the following problem (revised as Christoph
suggested): In 2.4.21-rc1 some inline functions are added to
asm-i386/byteorder.h. When __STRICT_ANSI__ is defined, __u64 doesn't get
defined by asm-i386/types.h, but it is used in one of the new inline
functions, __arch__swab64() - this causes a compile error for any program
that includes linux/cdrom.h and is built with -ansi. See also Christoph's
other comments on the list.

On Tue, 6 May 2003, Christoph Hellwig wrote:
> [..]
> You might want to reorder the code a bit to have only one
> __STRICT_ANSI__ ifdef, but else it looks fine.

// Thomas

--- linux-2.4.21-rc1-orig/include/asm-i386/byteorder.h 2003-05-06 09:52:33.000000000 +0100
+++ linux-2.4.21-rc1-ac4/include/asm-i386/byteorder.h 2003-05-06 11:20:01.000000000 +0100
@@ -34,7 +34,7 @@
return x;
}

-
+#ifndef __STRICT_ANSI__
static inline __u64 ___arch__swab64(__u64 val)
{
union {
@@ -54,12 +54,14 @@
return v.u;
}

+#define __BYTEORDER_HAS_U64__
#define __arch__swab64(x) ___arch__swab64(x)
+
+#endif /* !__STRICT_ANSI__ */
+
#define __arch__swab32(x) ___arch__swab32(x)
#define __arch__swab16(x) ___arch__swab16(x)

-#define __BYTEORDER_HAS_U64__
-
#endif /* __GNUC__ */

#include <linux/byteorder/little_endian.h>

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