clean up __STRICT_ANSI__ from types.h and byteorder.h
PATCH 1/1 clean up __STRICT_ANSI__ from types.h and byteorder.h
Kernel has used __STRICT_ANSI__ to declare __u64 and __s64 at include/*/types.h and include/*/byteorder.h. For example, include/asm-i386/types.h has:
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __signed__ long long __s64; typedef unsigned long long __u64; #endif
I, however, think this #ifdefs was existed for histrical reasons, and we can eliminate #ifdefs with the below reasons:
- __STRICT_ANSI__ is mostly used with #ifdef __GNUC__. But, interestingly, gcc (from minimal supported 2.95.3 to 3.3, I checked) does not show any warning messages with -ansi option, if compilation files include kernel headers and such files have u64 declations. So __STRICT_ANSI__ does not make sense for checking "gcc -ansi".
- A lot of headers use __s64 and __u64 even if it's excluded from __KERNEL__ declaration without __STRICT_ANSI__. In fact, __STRICT_ANSI__ is used only for declaring __u64 and __s64 in include/*/{types.h,byteorder.h}. So, nowadays we don't take care of -ansi things.
- Header files are sometimes used by userland applications. But I heard that this __STRICT_ANSI__ broke compilation of various applications with "gcc -ansi" options (ex: some KDE applications on a few architectures). -ansi can be used for checking name space pollution, but apparently __s64 and __u64 is out of this issue.
- American National Standard X3.159-1989 (ISO C90) does not say about "long long", so it seems using __STRICT_ANSI__ *was* appropriate. But now, there is the new C standard ISO C99 which has been getting popularity. It has "long long".
So, from above reasons, this __STRICT_ANSI__ does not affect any positive results these days, and I think it's ok to remove.
This patch is for 2.6.6 and today's linus-2.5 bk. It cleans up __STRICT_ANSI__ from asm-*/{types.h, byteorder.h} and linux/types.h.
Regards,
-- gotom
include/asm-arm/byteorder.h +2 -4
@@ -18,10 +18,8 @@#include <asm/types.h> -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#ifdef __ARMEB__#include <linux/byteorder/big_endian.h>
include/asm-arm/types.h +0 -2
@@ -19,10 +19,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* __ASSEMBLY__ */
include/asm-arm26/byteorder.h +2 -4
@@ -13,10 +13,8 @@#include <asm/types.h> -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#include <linux/byteorder/little_endian.h>
include/asm-arm26/types.h +0 -2
@@ -19,10 +19,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* __ASSEMBLY__ */
include/asm-cris/byteorder.h +2 -4
@@ -12,10 +12,8 @@#define __arch__swab32 (x) ___arch__swab32(x)#define __arch__swab16 (x) ___arch__swab16(x) -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#endif /* __GNUC__ */
include/asm-cris/types.h +0 -2
@@ -19,10 +19,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* __ASSEMBLY__ */
include/asm-h8300/byteorder.h +2 -4
@@ -3,10 +3,8 @@#include <asm/types.h> -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#include <linux/byteorder/big_endian.h>
include/asm-h8300/types.h +0 -2
@@ -27,10 +27,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif /* * These aren't exported outside the kernel to avoid name space clashes
include/asm-i386/types.h +0 -2
@@ -19,10 +19,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* __ASSEMBLY__ */
include/asm-m68k/byteorder.h +2 -4
@@ -15,10 +15,8 @@#endif -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#include <linux/byteorder/big_endian.h>
include/asm-m68k/types.h +0 -2
@@ -27,10 +27,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* __ASSEMBLY__ */
include/asm-m68knommu/byteorder.h +2 -4
@@ -3,10 +3,8 @@#include <asm/types.h> -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#include <linux/byteorder/big_endian.h>
include/asm-mips/byteorder.h +2 -8
@@ -10,14 +10,8 @@#include <asm/types.h> -#ifdef __GNUC__ - -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif - -#endif /* __GNUC__ */ +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#if defined (__MIPSEB__)# include <linux/byteorder/big_endian.h>
include/asm-mips/types.h +0 -4
@@ -34,10 +34,8 @@#else -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif
@@ -70,10 +68,8 @@#else -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long s64 ;typedef unsigned long long u64 ; -#endif #endif
include/asm-parisc/byteorder.h +1 -1
@@ -60,7 +60,7 @@ }#define __arch__swab64 (x) ___arch__swab64(x)#define __BYTEORDER_HAS_U64__ -#elif !defined(__STRICT_ANSI__) +#else static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) {__u32 t1 =___arch__swab32 ((__u32 ) x);
include/asm-parisc/types.h +0 -2
@@ -19,10 +19,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* __ASSEMBLY__ */
include/asm-ppc/byteorder.h +2 -4
@@ -64,10 +64,8 @@#endif /* __KERNEL__ */ -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#endif /* __GNUC__ */
include/asm-ppc/types.h +0 -2
@@ -12,10 +12,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif typedef struct { __u32 u[4];
include/asm-ppc64/byteorder.h +0 -2
@@ -85,9 +85,7 @@#endif /* __KERNEL__ */ -#ifndef __STRICT_ANSI__#define __BYTEORDER_HAS_U64__ -#endif #endif /* __GNUC__ */
include/asm-s390/byteorder.h +1 -3
@@ -116,12 +116,10 @@#define __arch__swab16s (x) ___arch__swab16s(x)#ifndef __s390x__ -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)# define __BYTEORDER_HAS_U64__# define __SWAB_64_THRU_32__ -#endif #else /* __s390x__ */ -#define __BYTEORDER_HAS_U64__ +# define __BYTEORDER_HAS_U64__#endif /* __s390x__ */ #endif /* __GNUC__ */
include/asm-s390/types.h +0 -2
@@ -28,10 +28,8 @@typedef unsigned int __u32 ;#ifndef __s390x__ -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #else /* __s390x__ */ typedef __signed__ long __s64 ;typedef unsigned long __u64 ;
include/asm-sh/byteorder.h +2 -4
@@ -42,10 +42,8 @@#define __arch__swab32 (x) ___arch__swab32(x)#define __arch__swab16 (x) ___arch__swab16(x) -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#ifdef __LITTLE_ENDIAN__#include <linux/byteorder/little_endian.h>
include/asm-sh/types.h +0 -2
@@ -19,10 +19,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* __ASSEMBLY__ */
include/asm-sparc/byteorder.h +2 -4
@@ -4,10 +4,8 @@#include <asm/types.h> -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#include <linux/byteorder/big_endian.h>
include/asm-v850/byteorder.h +2 -4
@@ -36,10 +36,8 @@#define __arch__swab32 (x) ___arch__swab32(x)#define __arch__swab16 (x) ___arch__swab16(x) -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __BYTEORDER_HAS_U64__ -# define __SWAB_64_THRU_32__ -#endif +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__#endif /* __GNUC__ */
include/asm-v850/types.h +0 -2
@@ -27,10 +27,8 @@ typedef __signed__ int __s32;typedef unsigned int __u32 ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)typedef __signed__ long long __s64 ;typedef unsigned long long __u64 ; -#endif #endif /* !__ASSEMBLY__ */
include/linux/types.h +2 -2
@@ -51,7 +51,7 @@typedef __kernel_gid_t gid_t ;#endif /* __KERNEL__ */ -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#if defined(__GNUC__)typedef __kernel_loff_t loff_t ;#endif
@@ -117,7 +117,7 @@typedef __u16 uint16_t ;typedef __u32 uint32_t ; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#if defined(__GNUC__)typedef __u64 uint64_t ;typedef __u64 u_int64_t ;typedef __s64 int64_t ;