From: GOTO Masanori <gotom@debian.or.jp>
To: torvalds@osdl.org, linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>,
Philip Blundell <pb@nexus.co.uk>,
gotom@debian.or.jp
Subject: [PATCH] clean up __STRICT_ANSI__ from types.h and byteorder.h
Date: Mon, 17 May 2004 01:02:07 +0900 [thread overview]
Message-ID: <81ad08z7gg.wl@omega.webmasters.gr.jp> (raw)
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
diff -Nuar linux-2.6.6/include/asm-arm/byteorder.h linux-2.6.6.gotom/include/asm-arm/byteorder.h
--- linux-2.6.6/include/asm-arm/byteorder.h 2004-04-04 12:37:38.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-arm/byteorder.h 2004-05-16 00:58:25.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-arm/types.h linux-2.6.6.gotom/include/asm-arm/types.h
--- linux-2.6.6/include/asm-arm/types.h 2004-04-04 12:36:14.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-arm/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-arm26/byteorder.h linux-2.6.6.gotom/include/asm-arm26/byteorder.h
--- linux-2.6.6/include/asm-arm26/byteorder.h 2004-04-04 12:37:40.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-arm26/byteorder.h 2004-05-16 00:58:51.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-arm26/types.h linux-2.6.6.gotom/include/asm-arm26/types.h
--- linux-2.6.6/include/asm-arm26/types.h 2004-04-04 12:36:13.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-arm26/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-cris/byteorder.h linux-2.6.6.gotom/include/asm-cris/byteorder.h
--- linux-2.6.6/include/asm-cris/byteorder.h 2004-04-04 12:36:14.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-cris/byteorder.h 2004-05-16 00:59:11.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-cris/types.h linux-2.6.6.gotom/include/asm-cris/types.h
--- linux-2.6.6/include/asm-cris/types.h 2004-04-04 12:37:23.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-cris/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-h8300/byteorder.h linux-2.6.6.gotom/include/asm-h8300/byteorder.h
--- linux-2.6.6/include/asm-h8300/byteorder.h 2004-04-04 12:36:14.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-h8300/byteorder.h 2004-05-16 00:59:34.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-h8300/types.h linux-2.6.6.gotom/include/asm-h8300/types.h
--- linux-2.6.6/include/asm-h8300/types.h 2004-04-04 12:37:27.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-h8300/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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
diff -Nuar linux-2.6.6/include/asm-i386/types.h linux-2.6.6.gotom/include/asm-i386/types.h
--- linux-2.6.6/include/asm-i386/types.h 2004-04-04 12:37:23.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-i386/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-m68k/byteorder.h linux-2.6.6.gotom/include/asm-m68k/byteorder.h
--- linux-2.6.6/include/asm-m68k/byteorder.h 2004-04-04 12:36:57.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-m68k/byteorder.h 2004-05-16 00:59:58.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-m68k/types.h linux-2.6.6.gotom/include/asm-m68k/types.h
--- linux-2.6.6/include/asm-m68k/types.h 2004-04-04 12:36:11.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-m68k/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-m68knommu/byteorder.h linux-2.6.6.gotom/include/asm-m68knommu/byteorder.h
--- linux-2.6.6/include/asm-m68knommu/byteorder.h 2004-04-04 12:36:26.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-m68knommu/byteorder.h 2004-05-16 01:00:24.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-mips/byteorder.h linux-2.6.6.gotom/include/asm-mips/byteorder.h
--- linux-2.6.6/include/asm-mips/byteorder.h 2004-04-04 12:37:23.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-mips/byteorder.h 2004-05-16 01:02:16.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-mips/types.h linux-2.6.6.gotom/include/asm-mips/types.h
--- linux-2.6.6/include/asm-mips/types.h 2004-04-04 12:36:17.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-mips/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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
diff -Nuar linux-2.6.6/include/asm-parisc/byteorder.h linux-2.6.6.gotom/include/asm-parisc/byteorder.h
--- linux-2.6.6/include/asm-parisc/byteorder.h 2004-04-04 12:37:45.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-parisc/byteorder.h 2004-05-12 23:03:47.000000000 +0900
@@ -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);
diff -Nuar linux-2.6.6/include/asm-parisc/types.h linux-2.6.6.gotom/include/asm-parisc/types.h
--- linux-2.6.6/include/asm-parisc/types.h 2004-04-04 12:36:24.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-parisc/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-ppc/byteorder.h linux-2.6.6.gotom/include/asm-ppc/byteorder.h
--- linux-2.6.6/include/asm-ppc/byteorder.h 2004-04-04 12:37:06.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-ppc/byteorder.h 2004-05-16 01:04:35.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-ppc/types.h linux-2.6.6.gotom/include/asm-ppc/types.h
--- linux-2.6.6/include/asm-ppc/types.h 2004-04-04 12:38:13.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-ppc/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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];
diff -Nuar linux-2.6.6/include/asm-ppc64/byteorder.h linux-2.6.6.gotom/include/asm-ppc64/byteorder.h
--- linux-2.6.6/include/asm-ppc64/byteorder.h 2004-04-04 12:38:23.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-ppc64/byteorder.h 2004-05-12 23:03:47.000000000 +0900
@@ -85,9 +85,7 @@
#endif /* __KERNEL__ */
-#ifndef __STRICT_ANSI__
#define __BYTEORDER_HAS_U64__
-#endif
#endif /* __GNUC__ */
diff -Nuar linux-2.6.6/include/asm-s390/byteorder.h linux-2.6.6.gotom/include/asm-s390/byteorder.h
--- linux-2.6.6/include/asm-s390/byteorder.h 2004-04-04 12:38:23.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-s390/byteorder.h 2004-05-16 01:05:27.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-s390/types.h linux-2.6.6.gotom/include/asm-s390/types.h
--- linux-2.6.6/include/asm-s390/types.h 2004-04-04 12:37:07.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-s390/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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;
diff -Nuar linux-2.6.6/include/asm-sh/byteorder.h linux-2.6.6.gotom/include/asm-sh/byteorder.h
--- linux-2.6.6/include/asm-sh/byteorder.h 2004-04-04 12:36:13.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-sh/byteorder.h 2004-05-16 01:05:47.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-sh/types.h linux-2.6.6.gotom/include/asm-sh/types.h
--- linux-2.6.6/include/asm-sh/types.h 2004-04-04 12:38:15.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-sh/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-sparc/byteorder.h linux-2.6.6.gotom/include/asm-sparc/byteorder.h
--- linux-2.6.6/include/asm-sparc/byteorder.h 2004-04-04 12:36:17.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-sparc/byteorder.h 2004-05-16 01:06:04.000000000 +0900
@@ -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>
diff -Nuar linux-2.6.6/include/asm-v850/byteorder.h linux-2.6.6.gotom/include/asm-v850/byteorder.h
--- linux-2.6.6/include/asm-v850/byteorder.h 2004-04-04 12:37:42.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-v850/byteorder.h 2004-05-16 01:06:17.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/asm-v850/types.h linux-2.6.6.gotom/include/asm-v850/types.h
--- linux-2.6.6/include/asm-v850/types.h 2004-04-04 12:38:00.000000000 +0900
+++ linux-2.6.6.gotom/include/asm-v850/types.h 2004-05-12 23:03:47.000000000 +0900
@@ -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__ */
diff -Nuar linux-2.6.6/include/linux/types.h linux-2.6.6.gotom/include/linux/types.h
--- linux-2.6.6/include/linux/types.h 2004-05-12 22:30:36.000000000 +0900
+++ linux-2.6.6.gotom/include/linux/types.h 2004-05-16 01:38:32.000000000 +0900
@@ -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;
reply other threads:[~2004-05-16 16:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81ad08z7gg.wl@omega.webmasters.gr.jp \
--to=gotom@debian.or.jp \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pb@nexus.co.uk \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®