On Sat, 19 Oct 2002, Warren Turkal wrote: > Here is a patch that should make Xmd.h use C99 when available. > --- /usr/include/X11/Xmd.h 2002-10-16 15:14:38.000000000 -0500 > +++ Xmd.h 2002-10-19 14:23:33.000000000 -0500 > @@ -47,6 +47,7 @@ > ******************************************************************/ > #ifndef XMD_H > #define XMD_H 1 > + > /* $Xorg: Xmd.h,v 1.4 2001/02/09 02:03:22 xorgcvs Exp $ */ > /* > * Xmd.h: MACHINE DEPENDENT DECLARATIONS. > @@ -101,6 +102,36 @@ > #define SIZEOF(x) sz_/**/x > #endif /* if ANSI C compiler else not */ > > +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ == 199901L) ^^ This should be >= > + > +#include <stdint.h> > + > +typedef uint8_t CARD8; > +typedef uint16_t CARD16; > +typedef uint32_t CARD32; > +typedef uint64_t CARD64; > + > +typedef int8_t INT8; > +typedef int16_t INT16; > +typedef int32_t INT32; > +typedef int64_t INT64; > + > +typedef CARD8 BYTE; > +typedef CARD8 BOOL; > + > +typedef CARD32 BITS32; > +typedef CARD16 BITS16; > + > +/*is there any reason why B32 and B16 cannot always be defined?*/ > +# if defined(WORD64) > +#define B32 :32 > +#define B16 :16 > +# else > +#define B32 > +#define B16 > +# endif > + > +#else //__STDC_VERSION__ > /* > * Bitfield suffixes for the protocol structure elements, if you > * need them. Note that bitfields are not guarranteed to be signed > @@ -165,6 +196,8 @@ > #define BOOL CARD8 > #endif /* __EMX__ */ > > +#endif // __STDC_VERSION__ > + > /* > * definitions for sign-extending bitfields on 64-bit architectures > */ I have spent the time to review this change and found that it does not work (at least not as intended). First, a minor problem is that even GCC 3.2 #define's __STDC_VERSION__ only if compiling with -std=c99 (or -std=gnu99), but not with -ansi (the default we use). I am given to understand that this will change in some future GCC. A larger issue is that, on some 32-bit systems, this ends up typedef'ing CARD32 as 'unsigned int', and on others, as 'unsigned long'. For reasons I won't get into here, the X sources currently need CARD32 to be typedef'ed as 'unsigned long' for all 32-bit environments. The same issue, without 'unsigned' occurs with INT32. Bottom line: The X sources are not yet ready for C99, and a lot more work than this relatively simple change is needed to make them so. Marc. +----------------------------------+-----------------------------------+ | Marc Aurele La France | work: 1-780-492-9310 | | Computing and Network Services | fax: 1-780-492-1729 | | 352 General Services Building | email: tsi@xxxxxxxxxxx | | University of Alberta +-----------------------------------+ | Edmonton, Alberta | | | T6G 2H1 | Standard disclaimers apply | | CANADA | | +----------------------------------+-----------------------------------+ XFree86 Core Team member. ATI driver and X server internals. _______________________________________________ Xpert mailing list Xpert@xxxxxxxxxxx http://XFree86.Org/mailman/listinfo/xpert