[Mesa-dev] [PATCH] gen_matypes: eliminate printf warnings

Brian Paul brianp at vmware.com
Fri Dec 9 06:56:14 PST 2011


On 12/09/2011 07:00 AM, nobled wrote:
> The VERT_BIT_* defines are 64-bit values since commit
> f364ac1da10ff67eba5196c1074aff579864f741, but the printf
> was still expecting a simple int. This worked on little-endian
> hosts because the values were still less than INT_MAX, but
> probably would've gone bad and printed zero on big-endian ones.
> ---
>   src/mesa/x86/gen_matypes.c |    7 ++++++-
>   1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
> index 648bf87..18baa29 100644
> --- a/src/mesa/x86/gen_matypes.c
> +++ b/src/mesa/x86/gen_matypes.c
> @@ -32,6 +32,11 @@
>    * Mesa, including lighting, clipping, texture image conversion etc.
>    */
>
> +#ifndef __STDC_FORMAT_MACROS
> +#define __STDC_FORMAT_MACROS
> +#endif
> +#include<inttypes.h>
> +
>   #include "main/glheader.h"
>   #include "main/mtypes.h"
>   #include "tnl/t_context.h"
> @@ -68,7 +73,7 @@ do {									\
>      printf( "#define %s\t%lu\n", s, (unsigned long) sizeof(t) );
>
>   #define DEFINE( s, d )							\
> -   printf( "#define %s\t0x%x\n", s, d );
> +   printf( "#define %s\t0x%"PRIx64"\n", s, (uint64_t) d );


I'm not sure that inttypes.h exists on Windows.  We may need some 
#ifdef stuff there.

-Brian



More information about the mesa-dev mailing list