[PATCH] Workaround for autoconf'ed define of caddr_t
Esben Haabendal
eha@dev.doredevelopment.dk
Wed Mar 30 14:12:00 GMT 2011
(comments in original mail was eaten by gnus)
Hi
When building canadian cross compiler, I have some trouble with
configure defining caddr_t as a macro, like
#define caddr_t char *
When combined with the types.h where caddr_t is protected together with
daddr_t, the typedef of caddr_t breaks.
This patch works around it by protecting the caddr_t typedef
specifically.
I am uncertain as to the real cause and solution to this :-(
Anyways, if you get problems with caddr_t in types.h, you might want to
try this.
/Esben
On Wed, 2011-03-30 at 16:08 +0200, Esben Haabendal wrote:
> differences between files attachment (glibc-typedef-caddr.patch),
> "crosstool-ng-1.10.0 glibc-typedef-caddr.patch"
> diff -urN crosstool-ng-1.10.0-orig/patches/glibc/2.12.2/910-typedef-caddr.patch crosstool-ng-1.10.0/patches/glibc/2.12.2/910-typedef-caddr.patch
> --- crosstool-ng-1.10.0-orig/patches/glibc/2.12.2/910-typedef-caddr.patch 1970-01-01 01:00:00.000000000 +0100
> +++ crosstool-ng-1.10.0/patches/glibc/2.12.2/910-typedef-caddr.patch 2011-03-29 14:43:54.702462657 +0200
> @@ -0,0 +1,28 @@
> +diff -urN glibc-2.12.2-orig/posix/sys/types.h glibc-2.12.2/posix/sys/types.h
> +--- glibc-2.12.2-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.12.2/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
> +@@ -114,7 +114,10 @@
> + #ifdef __USE_BSD
> + # ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + # endif
> + #endif
> +diff -urN glibc-2.12.2-orig/sunrpc/rpc/types.h glibc-2.12.2/sunrpc/rpc/types.h
> +--- glibc-2.12.2-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.12.2/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
> +@@ -80,7 +80,10 @@
> + #endif
> + #ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + #endif
> +
> diff -urN crosstool-ng-1.10.0-orig/patches/glibc/2.12.1/910-typedef-caddr.patch crosstool-ng-1.10.0/patches/glibc/2.12.1/910-typedef-caddr.patch
> --- crosstool-ng-1.10.0-orig/patches/glibc/2.12.1/910-typedef-caddr.patch 1970-01-01 01:00:00.000000000 +0100
> +++ crosstool-ng-1.10.0/patches/glibc/2.12.1/910-typedef-caddr.patch 2011-03-29 14:43:54.702462657 +0200
> @@ -0,0 +1,28 @@
> +diff -urN glibc-2.12.1-orig/posix/sys/types.h glibc-2.12.1/posix/sys/types.h
> +--- glibc-2.12.1-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.12.1/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
> +@@ -114,7 +114,10 @@
> + #ifdef __USE_BSD
> + # ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + # endif
> + #endif
> +diff -urN glibc-2.12.1-orig/sunrpc/rpc/types.h glibc-2.12.1/sunrpc/rpc/types.h
> +--- glibc-2.12.1-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.12.1/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
> +@@ -80,7 +80,10 @@
> + #endif
> + #ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + #endif
> +
> diff -urN crosstool-ng-1.10.0-orig/patches/glibc/2.11.1/910-typedef-caddr.patch crosstool-ng-1.10.0/patches/glibc/2.11.1/910-typedef-caddr.patch
> --- crosstool-ng-1.10.0-orig/patches/glibc/2.11.1/910-typedef-caddr.patch 1970-01-01 01:00:00.000000000 +0100
> +++ crosstool-ng-1.10.0/patches/glibc/2.11.1/910-typedef-caddr.patch 2011-03-29 14:43:54.702462657 +0200
> @@ -0,0 +1,28 @@
> +diff -urN glibc-2.11.1-orig/posix/sys/types.h glibc-2.11.1/posix/sys/types.h
> +--- glibc-2.11.1-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.11.1/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
> +@@ -114,7 +114,10 @@
> + #ifdef __USE_BSD
> + # ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + # endif
> + #endif
> +diff -urN glibc-2.11.1-orig/sunrpc/rpc/types.h glibc-2.11.1/sunrpc/rpc/types.h
> +--- glibc-2.11.1-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.11.1/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
> +@@ -80,7 +80,10 @@
> + #endif
> + #ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + #endif
> +
> diff -urN crosstool-ng-1.10.0-orig/patches/glibc/2.11/910-typedef-caddr.patch crosstool-ng-1.10.0/patches/glibc/2.11/910-typedef-caddr.patch
> --- crosstool-ng-1.10.0-orig/patches/glibc/2.11/910-typedef-caddr.patch 1970-01-01 01:00:00.000000000 +0100
> +++ crosstool-ng-1.10.0/patches/glibc/2.11/910-typedef-caddr.patch 2011-03-29 14:43:54.702462657 +0200
> @@ -0,0 +1,28 @@
> +diff -urN glibc-2.11-orig/posix/sys/types.h glibc-2.11/posix/sys/types.h
> +--- glibc-2.11-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.11/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
> +@@ -114,7 +114,10 @@
> + #ifdef __USE_BSD
> + # ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + # endif
> + #endif
> +diff -urN glibc-2.11-orig/sunrpc/rpc/types.h glibc-2.11/sunrpc/rpc/types.h
> +--- glibc-2.11-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.11/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
> +@@ -80,7 +80,10 @@
> + #endif
> + #ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + #endif
> +
> diff -urN crosstool-ng-1.10.0-orig/patches/glibc/2.10.1/910-typedef-caddr.patch crosstool-ng-1.10.0/patches/glibc/2.10.1/910-typedef-caddr.patch
> --- crosstool-ng-1.10.0-orig/patches/glibc/2.10.1/910-typedef-caddr.patch 1970-01-01 01:00:00.000000000 +0100
> +++ crosstool-ng-1.10.0/patches/glibc/2.10.1/910-typedef-caddr.patch 2011-03-29 14:43:54.702462657 +0200
> @@ -0,0 +1,28 @@
> +diff -urN glibc-2.10.1-orig/posix/sys/types.h glibc-2.10.1/posix/sys/types.h
> +--- glibc-2.10.1-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.10.1/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
> +@@ -114,7 +114,10 @@
> + #ifdef __USE_BSD
> + # ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + # endif
> + #endif
> +diff -urN glibc-2.10.1-orig/sunrpc/rpc/types.h glibc-2.10.1/sunrpc/rpc/types.h
> +--- glibc-2.10.1-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.10.1/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
> +@@ -80,7 +80,10 @@
> + #endif
> + #ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + #endif
> +
> diff -urN crosstool-ng-1.10.0-orig/patches/glibc/2.9/910-typedef-caddr.patch crosstool-ng-1.10.0/patches/glibc/2.9/910-typedef-caddr.patch
> --- crosstool-ng-1.10.0-orig/patches/glibc/2.9/910-typedef-caddr.patch 1970-01-01 01:00:00.000000000 +0100
> +++ crosstool-ng-1.10.0/patches/glibc/2.9/910-typedef-caddr.patch 2011-03-29 14:43:54.702462657 +0200
> @@ -0,0 +1,28 @@
> +diff -urN glibc-2.9-orig/posix/sys/types.h glibc-2.9/posix/sys/types.h
> +--- glibc-2.9-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.9/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
> +@@ -114,7 +114,10 @@
> + #ifdef __USE_BSD
> + # ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + # endif
> + #endif
> +diff -urN glibc-2.9-orig/sunrpc/rpc/types.h glibc-2.9/sunrpc/rpc/types.h
> +--- glibc-2.9-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
> ++++ glibc-2.9/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
> +@@ -80,7 +80,10 @@
> + #endif
> + #ifndef __daddr_t_defined
> + typedef __daddr_t daddr_t;
> ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
> + typedef __caddr_t caddr_t;
> ++# define __caddr_t_defined
> ++# endif
> + # define __daddr_t_defined
> + #endif
> +
>
>
>
> YMMV.
>
> /Esben
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list