[Mesa-dev] [PATCH] glsl: fix compile errors with mingw due to missing PRIx64 definitions

Ian Romanick idr at freedesktop.org
Tue Jan 24 21:37:07 UTC 2017


On 01/23/2017 11:21 AM, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
> 
> define __STDC_FORMAT_MACROS and include <inttypes.h> (same as
> ir_builder_print_visitor.cpp already does).
> 
> Otherwise, some mingw build errors out (since
> 8e7e1ae0365ddc7edb0d4d98250ab46728e6c14a and
> bbce1c538dc0cb8bf3769510283d11847dc07540 presumably) with:
> src/compiler/glsl/ir_print_visitor.cpp:479:40: error: expected ‘)’ before ‘PRIu64’
>    case GLSL_TYPE_UINT64:fprintf(f, "%" PRIu64, ir->value.u64[i]); break;
> 
> (Note even with that fix I get other format specifier warnings:
> src/compiler/glsl/ir_print_visitor.cpp:473:47:
> warning: unknown conversion type character ‘a’ in format [-Wformat=]
>                 fprintf(f, "%a", ir->value.f[i]);
>                                                ^
> src/compiler/glsl/ir_print_visitor.cpp:473:47:
> warning: too many arguments for format [-Wformat-extra-args]
> but it still compiles at least)

Ouch.  That was added over 3 years ago.

commit 1ecfdba98a346c8bb05ad9403e3a6412574215f4
Author: Matt Turner <mattst88 at gmail.com>
Date:   Sun Aug 4 14:01:30 2013 -0700

    glsl: Add heuristics to print floating-point numbers better.

    v2: Fix *.expected files to match.
    Reviewed-by: Paul Berry <strereotype441 at gmail.com>

> ---
>  src/compiler/glsl/glsl_parser_extras.cpp | 2 ++
>  src/compiler/glsl/ir_print_visitor.cpp   | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index e888090..3d2fc14 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -20,6 +20,8 @@
>   * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>   * DEALINGS IN THE SOFTWARE.
>   */
> +#define __STDC_FORMAT_MACROS 1
> +#include <inttypes.h> /* for PRIx64 macro */
>  #include <stdio.h>
>  #include <stdarg.h>
>  #include <string.h>
> diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp
> index 0763277..debbdad 100644
> --- a/src/compiler/glsl/ir_print_visitor.cpp
> +++ b/src/compiler/glsl/ir_print_visitor.cpp
> @@ -21,6 +21,8 @@
>   * DEALINGS IN THE SOFTWARE.
>   */
>  
> +#define __STDC_FORMAT_MACROS 1
> +#include <inttypes.h> /* for PRIx64 macro */
>  #include "ir_print_visitor.h"
>  #include "compiler/glsl_types.h"
>  #include "glsl_parser_extras.h"
> 



More information about the mesa-dev mailing list