[Mesa-dev] [PATCH] fix compilation of glsl_lexer.ll with msvc

Kenneth Graunke kenneth at whitecape.org
Sat Oct 29 02:50:28 PDT 2011


On 10/29/2011 01:42 AM, Morgan Armand wrote:
> strtoull is not supported on msvc (as there is no C99 support).
> 
> ---
>  src/glsl/glsl_lexer.ll |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
> index e444536..00065d5 100644
> --- a/src/glsl/glsl_lexer.ll
> +++ b/src/glsl/glsl_lexer.ll
> @@ -93,7 +93,11 @@ literal_integer(char *text, int len, struct
> _mesa_glsl_parse_state *state,
>     if (base == 16)
>        digits += 2;
>  
> +#ifdef _MSC_VER
> +   __int64 value = _strtoui64(digits, NULL, base);

Presumably this should be "unsigned __int64" to match the code below?

> +#else
>     unsigned long long value = strtoull(digits, NULL, base);
> +#endif
>  
>     lval->n = (int)value;

I kind of wish we just had c99.c/c99.h files with #ifdef MSVC guards
that defined the necessary missing C99 functions, with their normal
names and arguments, in terms of their MSVC equivalent.  Then we
wouldn't need to litter the code with workarounds.

Though, that's something for a later time.


More information about the mesa-dev mailing list