[PATCH] Fix linux/types.h for compiling with -ansi

From: simon schuler (simon.schuler_at_gmx.ch)
Date: 11/27/04

  • Next message: Takashi Iwai: "Re: [Alsa-devel] [2.6 patch] ALSA core: misc cleanups"
    Date:	Sat, 27 Nov 2004 18:24:51 +0000
    To: linux-kernel@vger.kernel.org, torvalds@osdl.org
    
    

    I've got a symple little patch to apply:
    when including <linux/types.h> in a program and compiling with 'gcc
    -ansi' gcc complains:
    `In file included from test.c:1:
    /usr/include/linux/types.h:162: error: parse error before "__le64"
    /usr/include/linux/types.h:163: error: parse error before "__be64"`

    These lines are:
    typedef __u64 __bitwise __le64;
    typedef __u64 __bitwise __be64;

    __u64 isn't defined in include/asm-386/types.h when __STRICT_ANSI__ is
    defined (as always when calling gcc -ansi):
    #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    typedef __signed__ long long __s64;
    typedef unsigned long long __u64;
    #endif

    The following patch for linux-2.6.10-rc2 solves the problem:
    (The patch wouldn't be needed for some 64Bit architectures, but i didn't
    find an easy way of sorting these out)

    diff -up include/linux/types.h include/linux/newtypes.h
    --- include/linux/types.h 2004-11-27 17:19:25.509948024 +0000
    +++ include/linux/types.h_new 2004-11-27 17:24:18.630386944 +0000
    @@ -157,8 +157,10 @@ typedef __u16 __bitwise __le16;
     typedef __u16 __bitwise __be16;
     typedef __u32 __bitwise __le32;
     typedef __u32 __bitwise __be32;
    +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
     typedef __u64 __bitwise __le64;
     typedef __u64 __bitwise __be64;
    +#endif

     struct ustat {
            __kernel_daddr_t f_tfree;

    -
    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/


  • Next message: Takashi Iwai: "Re: [Alsa-devel] [2.6 patch] ALSA core: misc cleanups"

    Relevant Pages

    • Re: [PATCH 12/39] NLKD/i386 - time adjustment
      ... The patch includes code that seems to imply that gcc can not do mpy of variables. ... I really do not see the relavence of the run time library patches given the above. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [Patch 24a/23] mask v2 - UP fix, faster mask_of_bit, MASK_ALL* names
      ... Patch 24/23 was fouled up beyond all recall. ... It closely follows some excellent suggestions from Matthew. ... 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/ ...
      (Linux-Kernel)
    • [2.6 patch] net/ipv6/: misc cleanups
      ... OK, updated patch below. ... static void sf_markstate(struct ifmcaddr6 *pmc); ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [BK PATCHES] 2.6.x net driver updates
      ... through these ChangeSets: ... This patch does an indentation fix to amd8111e_rx_pollwhich was ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH 1/2] new valid_signal function (fwd)
      ... A while back I attempted to fix a little, not at all critical, gcc -W ... Below is the first patch that adds the new function. ... pointless and generates warnings when building with gcc -W. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)