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

2011-12-09 Thread nobled
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 );



-- 
1.7.4.1
From f88d54fde18f4109b5af5d90e513ef761e4021bd Mon Sep 17 00:00:00 2001
From: nobled nob...@dreamwidth.org
Date: Thu, 8 Dec 2011 20:53:25 +
Subject: [PATCH 2/4] gen_matypes: eliminate printf warnings

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 );
 
 
 
-- 
1.7.4.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2011-12-09 Thread Brian Paul

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
+#includeinttypes.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

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2011-12-09 Thread Jose Fonseca


- Original Message -
 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
  +#includeinttypes.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.

We provide our own in mesa/include/c99/ so it should be ok.

Jose
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2011-12-09 Thread Brian Paul

On 12/09/2011 07:59 AM, Jose Fonseca wrote:



- Original Message -

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
+#includeinttypes.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.


We provide our own in mesa/include/c99/ so it should be ok.


Oh that's right.

BTW, there's a few other places where we want to print 64-bit values 
and use the %llx format plus (unsigned long long) casting.  But that 
generates warnings on some platforms.  I think we could fix those if 
we used the PRI macros in those places.


-Brian
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2011-12-09 Thread Jose Fonseca
- Original Message -
 On 12/09/2011 07:59 AM, Jose Fonseca wrote:
 
 
  - Original Message -
  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
  +#includeinttypes.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.
 
  We provide our own in mesa/include/c99/ so it should be ok.
 
 Oh that's right.
 
 BTW, there's a few other places where we want to print 64-bit values
 and use the %llx format plus (unsigned long long) casting.  But that
 generates warnings on some platforms.  I think we could fix those if
 we used the PRI macros in those places.

Sounds good. I think the mesa/include/c99/inttypes.h is fairly comprehensive. 
If not we could just add any missing bits.

Jose
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev