Skip to contentSkip to conversation

2.4.21-rc1: byteorder.h breaks with __STRICT_ANSI__ defined (trivial)

PATCH New Thomas Horsten 1 participant 1 message May 6, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 2.4.21-rc1: byteorder.h breaks with __STRICT_ANSI__ defined (trivial)

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.

Quoted 3 lines · Christoph Hellwig

[..]
You might want to reorder the code a bit to have only one __STRICT_ANSI__ ifdef, but else it looks fine.

// Thomas

include/asm-i386/byteorder.h +5 -3
@@ -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>