public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove strict ansi check from __u64 in asm/types.h
@ 2007-08-06 17:23 Olaf Hering
  2007-08-06 17:41 ` H. Peter Anvin
  2007-08-10  8:27 ` Olaf Hering
  0 siblings, 2 replies; 7+ messages in thread
From: Olaf Hering @ 2007-08-06 17:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michael Matz


Up to now SuSE used its own version if /usr/include/{asm,linux},
which provided 64bit types for applications.
Recently we switched to a tree generated by make headers_install_all.
This lead to a few fixable compile errors in applications, and reduced
diskspace requirements by the linux-kernel-headers.noarch.rpm

KDE is compiled with -ansi for some reason. All KDE apps get this flag
via the KDE build system.
Kaffeine includes /usr/include/linux/dvb/dmx.h. This header uses __u64.
Kaffeine fails to compile because __u64 is not available.

Remove the __STRICT_ANSI__ check from the __u64/__s64 declaration on
32bit targets.

Here is the reason why we think the check should be relaxed:

....
> > > One thing for example is the -ansi flag in KDE. From what I heard, this
> > > disables all 64bit types on 32bit targets because ANSI has no long long.
> >
> > This is wrong.  long long is supported with -ansi just fine.
>
> So is the __STRICT_ANSI__ check in asm/types.h wrong and should be
> removed?

Well, GCC can be made to warn about usage of long long types with ISO C90
(-ansi), but only with -pedantic.  You can write this in a way that even
then it doesn't cause warnings, namely by:

#ifdef __GNUC__
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#endif

The __extension__ keyword in front of this switches off any pedantic
warnings for this expression.
....

sparc does not wrap __u64 defines for some reason.

(Currently) untested patch below.

Signed-off-by: Olaf Hering <olh@suse.de>
---
 include/asm-arm/types.h      |    6 +++---
 include/asm-avr32/types.h    |    6 +++---
 include/asm-blackfin/types.h |    6 +++---
 include/asm-cris/types.h     |    6 +++---
 include/asm-frv/types.h      |    6 +++---
 include/asm-h8300/types.h    |    6 +++---
 include/asm-i386/types.h     |    6 +++---
 include/asm-m32r/types.h     |    6 +++---
 include/asm-m68k/types.h     |    6 +++---
 include/asm-mips/types.h     |    6 +++---
 include/asm-parisc/types.h   |    6 +++---
 include/asm-powerpc/types.h  |    6 +++---
 include/asm-s390/types.h     |    6 +++---
 include/asm-sh/types.h       |    6 +++---
 include/asm-sh64/types.h     |    6 +++---
 include/asm-v850/types.h     |    6 +++---
 include/asm-xtensa/types.h   |    6 +++---
 17 files changed, 51 insertions(+), 51 deletions(-)

--- a/include/asm-arm/types.h
+++ b/include/asm-arm/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-avr32/types.h
+++ b/include/asm-avr32/types.h
@@ -25,9 +25,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-blackfin/types.h
+++ b/include/asm-blackfin/types.h
@@ -27,9 +27,9 @@ typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
 /* HK0617   -- Changes to unsigned long temporarily */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif				/* __ASSEMBLY__ */
--- a/include/asm-cris/types.h
+++ b/include/asm-cris/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-frv/types.h
+++ b/include/asm-frv/types.h
@@ -30,9 +30,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-h8300/types.h
+++ b/include/asm-h8300/types.h
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 /*
--- a/include/asm-i386/types.h
+++ b/include/asm-i386/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-m32r/types.h
+++ b/include/asm-m32r/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 #endif /* __ASSEMBLY__ */
 
--- a/include/asm-m68k/types.h
+++ b/include/asm-m68k/types.h
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -34,9 +34,9 @@ typedef unsigned long __u64;
 
 #else
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif
--- a/include/asm-parisc/types.h
+++ b/include/asm-parisc/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-powerpc/types.h
+++ b/include/asm-powerpc/types.h
@@ -40,9 +40,9 @@ typedef unsigned int __u32;
 typedef __signed__ long __s64;
 typedef unsigned long __u64;
 #else
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 #endif /* __powerpc64__ */
 
--- a/include/asm-s390/types.h
+++ b/include/asm-s390/types.h
@@ -28,9 +28,9 @@ typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
 #ifndef __s390x__
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 #else /* __s390x__ */
 typedef __signed__ long __s64;
--- a/include/asm-sh/types.h
+++ b/include/asm-sh/types.h
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-sh64/types.h
+++ b/include/asm-sh64/types.h
@@ -30,9 +30,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
--- a/include/asm-v850/types.h
+++ b/include/asm-v850/types.h
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* !__ASSEMBLY__ */
--- a/include/asm-xtensa/types.h
+++ b/include/asm-xtensa/types.h
@@ -29,9 +29,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 /*

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] remove strict ansi check from __u64 in asm/types.h
  2007-08-06 17:23 [PATCH] remove strict ansi check from __u64 in asm/types.h Olaf Hering
@ 2007-08-06 17:41 ` H. Peter Anvin
  2007-08-07  0:13   ` Mike Frysinger
  2007-08-10  8:27 ` Olaf Hering
  1 sibling, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2007-08-06 17:41 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel, Michael Matz

Olaf Hering wrote:
> 
> Remove the __STRICT_ANSI__ check from the __u64/__s64 declaration on
> 32bit targets.
> 
> Here is the reason why we think the check should be relaxed:
> 

I think the fact that "long long" was made official C in C99 is good
enough.  Flagging them as __extension__ is okay, I guess, but something
like this should definitely go in.

	-hpa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] remove strict ansi check from __u64 in asm/types.h
  2007-08-06 17:41 ` H. Peter Anvin
@ 2007-08-07  0:13   ` Mike Frysinger
  2007-08-07 13:57     ` Michael Matz
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2007-08-07  0:13 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Olaf Hering, linux-kernel, Michael Matz

On 8/6/07, H. Peter Anvin <hpa@zytor.com> wrote:
> Olaf Hering wrote:
> >
> > Remove the __STRICT_ANSI__ check from the __u64/__s64 declaration on
> > 32bit targets.
> >
> > Here is the reason why we think the check should be relaxed:
>
> I think the fact that "long long" was made official C in C99 is good
> enough.  Flagging them as __extension__ is okay, I guess, but something
> like this should definitely go in.

the patch we (Gentoo) tried posting a while ago never saw any response:
http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo/src/patchsets/gentoo-headers/2.6.22/35_all_c99-types.patch?rev=1.2
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] remove strict ansi check from __u64 in asm/types.h
  2007-08-07  0:13   ` Mike Frysinger
@ 2007-08-07 13:57     ` Michael Matz
  2007-08-12 18:07       ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Matz @ 2007-08-07 13:57 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: H. Peter Anvin, Olaf Hering, linux-kernel

Hi,

On Mon, 6 Aug 2007, Mike Frysinger wrote:

> On 8/6/07, H. Peter Anvin <hpa@zytor.com> wrote:
> > Olaf Hering wrote:
> > >
> > > Remove the __STRICT_ANSI__ check from the __u64/__s64 declaration on
> > > 32bit targets.
> > >
> > > Here is the reason why we think the check should be relaxed:
> >
> > I think the fact that "long long" was made official C in C99 is good
> > enough.  Flagging them as __extension__ is okay, I guess, but something
> > like this should definitely go in.
> 
> the patch we (Gentoo) tried posting a while ago never saw any response:
> http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo/src/patchsets/gentoo-headers/2.6.22/35_all_c99-types.patch?rev=1.2

That would still make it not work with programs compiled with just -ansi 
or -std=c90 (both being equivalent) with -pedantic added.  There still are 
such.  Only for that case is the __extension__ prefix necessary.


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] remove strict ansi check from __u64 in asm/types.h
  2007-08-06 17:23 [PATCH] remove strict ansi check from __u64 in asm/types.h Olaf Hering
  2007-08-06 17:41 ` H. Peter Anvin
@ 2007-08-10  8:27 ` Olaf Hering
  2007-08-10  8:34   ` Andrew Morton
  1 sibling, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2007-08-10  8:27 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton; +Cc: Michael Matz

On Mon, Aug 06, Olaf Hering wrote:

> Remove the __STRICT_ANSI__ check from the __u64/__s64 declaration on
> 32bit targets.

> (Currently) untested patch below.

We tested this now, and it did not cause failures.

Andrew, will you pick this up?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] remove strict ansi check from __u64 in asm/types.h
  2007-08-10  8:27 ` Olaf Hering
@ 2007-08-10  8:34   ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2007-08-10  8:34 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel, Michael Matz

On Fri, 10 Aug 2007 10:27:26 +0200 Olaf Hering <olh@suse.de> wrote:

> On Mon, Aug 06, Olaf Hering wrote:
> 
> > Remove the __STRICT_ANSI__ check from the __u64/__s64 declaration on
> > 32bit targets.
> 
> > (Currently) untested patch below.
> 
> We tested this now, and it did not cause failures.
> 
> Andrew, will you pick this up?

can take a look, sure.  Can you send a version with a less scruffy-looking
changelog please?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] remove strict ansi check from __u64 in asm/types.h
  2007-08-07 13:57     ` Michael Matz
@ 2007-08-12 18:07       ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2007-08-12 18:07 UTC (permalink / raw)
  To: Michael Matz; +Cc: H. Peter Anvin, Olaf Hering, linux-kernel

On 8/7/07, Michael Matz <matz@suse.de> wrote:
> That would still make it not work with programs compiled with just -ansi
> or -std=c90 (both being equivalent) with -pedantic added.  There still are
> such.  Only for that case is the __extension__ prefix necessary.

i thought the point was it's supposed to fail with just -ansi and the
default standard (c89)

at any rate, as long as your changes account for all the files in the
patch i posted, that's fine by me
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-08-12 18:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-06 17:23 [PATCH] remove strict ansi check from __u64 in asm/types.h Olaf Hering
2007-08-06 17:41 ` H. Peter Anvin
2007-08-07  0:13   ` Mike Frysinger
2007-08-07 13:57     ` Michael Matz
2007-08-12 18:07       ` Mike Frysinger
2007-08-10  8:27 ` Olaf Hering
2007-08-10  8:34   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox