Re: [PATCH] define own version of PRIdPTR on platform where its not available

Karel Gardas <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Hi Ian,

I'm resending the patch changed in a way you prefer (as I hope) with 
comparison of void_p and int sizes. Generally speaking I like the idea 
you have described in previous patch email thread to better support 
cross-compiling, but I would still prefer if the patch may be merged in 
(even temporarily!) just to unbreak builds on Solaris. Once this is 
done, I'll be able to continue with reseting solaris buildbot zone etc.

Thanks!
Karel



On 11/ 8/12 10:04 PM, Karel Gardas wrote:
> Note that PRIdPTR is considered as linux-ism so it's not available on platforms
> like Solaris, although some other free Unix(-like) OSes apparently supports
> it too.
> ---
>   includes/mkDerivedConstants.c |   10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
> index 7009a3f..bd2214e 100644
> --- a/includes/mkDerivedConstants.c
> +++ b/includes/mkDerivedConstants.c
> @@ -30,6 +30,16 @@
>   #include<stdio.h>
>   #include<string.h>
>
> +#if !defined(PRIdPTR)
> +#if SIZEOF_VOID_P == SIZEOF_INT
> +/* compiling for 32bit target */
> +#define PRIdPTR "d"
> +#else
> +/* compiling for 64bit target */
> +#define PRIdPTR "ld"
> +#endif
> +#endif
> +
>   enum Mode { Gen_Haskell_Type, Gen_Haskell_Value, Gen_Haskell_Wrappers, Gen_Haskell_Exports, Gen_Header } mode;
>
>   #define str(a,b) #a "_" #b
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.