On Tue, Jul 28, 2009 at 09:14:04PM -0600, tom fogal wrote:
> Chia-I Wu <olva...@gmail.com> writes:
> > On Tue, Jul 28, 2009 at 11:10:43AM -0600, tom fogal wrote:
> > > Hrm. I would argue that both places should read something more like:
> > > #if C99 is supported
> > > # include <stdint.h>
> > > #else
> > > /* some typedefs */
> > > #endif
> > > Or perhaps something more robust / maintained by a third party
> > > entity (like the `msinttypes' project you mention; boost has a
> > > similar header which probably isn't C++-specific; I'm sure there's
> > > others out there) could be integrated.
> > > Anyway, presumably the above #if sequence would "just work" when
> > > (if?) MS finally decides to support enough C99 to update that
> > > define.
> > I prefer your c99/non-c99 method, both in eglcompiler.h and mesa's
> > main compiler.h. But my concern is that I only have gcc to test.
> > Only if I have more platforms (i.e. visual studio) to test, or
> > someone would like to help, I am not comfortable enough to send a
> > patch that changes compiler.h.
> I'll be honest, even after half-paying-attention here for awhile, I'd
> have to google EGL to know what it is, let alone how to enable it. I'd
> volunteer to test compiler.h on vs2008 though, and presumably the code
> would be the same in both places so that'd be enough.
hmm, I couldn't come up with a sane way to handle the #else part. The
best I can do is to prefer stdint.h on c99 compiler, as can be seen in
the attachment. The only thing needs to be tested becomes does VS
guarantee the existence of stdint.h when it claims c99? But this does
not so justify the change to me...
--
Regards,
olv
>From 76f832067125fa9e2a810c3b2f429602d2f973c7 Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olva...@gmail.com>
Date: Wed, 29 Jul 2009 11:43:05 +0800
Subject: [PATCH] compiler: Prefer stdint.h if compiled with a C99 compiler.
---
src/mesa/main/compiler.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 9319505..4b6144b 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -60,7 +60,9 @@ extern "C" {
/**
* Get standard integer types
*/
-#if defined(_MSC_VER)
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+# include <stdint.h>
+#elif defined(_MSC_VER)
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
--
1.6.2.4
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev