[Mesa-dev] [PATCH] glsl: Fix MSVC build (missing strcasecmp())

Ian Romanick idr at freedesktop.org
Fri Oct 18 20:10:51 CEST 2013


On 10/17/2013 01:52 PM, Paul Berry wrote:
> MSVC doesn't have a strcasecmp() function; it uses _stricmp() instead.

We've worked around similar issues by putting a wrapper in imports.h.
This fix will work here, but as soon as we add another use of
strcasecmp, we'll need to patch it again...

We should just add

#define strcasecmp(s1, s2) _stricmp(s1, s2)

right next to the #define of strtoll in imports.h.

> ---
>  src/glsl/glsl_parser.yy | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index ba2dc63..00589e2 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -66,8 +66,14 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
>      */
>     if (state->es_shader)
>        return strcmp(s1, s2);
> -   else
> +   else {
> +#if defined(_MSC_VER)
> +      /* MSVC doesn't have a strcasecmp() function; instead it has _stricmp. */
> +      return _stricmp(s1, s2);
> +#else
>        return strcasecmp(s1, s2);
> +#endif
> +   }
>  }
>  %}
>  
> 



More information about the mesa-dev mailing list