Bug 98681 - ir_builder_print_visitor.cpp:401:67: error: expected ')' before 'PRIx64'
Summary: ir_builder_print_visitor.cpp:401:67: error: expected ')' before 'PRIx64'
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords: bisected, regression
Depends on:
Blocks:
 
Reported: 2016-11-11 08:29 UTC by Vinson Lee
Modified: 2016-11-11 18:00 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Vinson Lee 2016-11-11 08:29:46 UTC
mesa: a5e88e66e633aaeb587b274d80e21cd46c8ee2cb (master 13.1.0-devel)

MinGW build error

  Compiling src/compiler/glsl/ir_builder_print_visitor.cpp ...
src/compiler/glsl/ir_builder_print_visitor.cpp: In member function 'virtual ir_visitor_status ir_builder_print_visitor::visit(ir_constant*)':
src/compiler/glsl/ir_builder_print_visitor.cpp:401:67: error: expected ')' before 'PRIx64'
                print_without_indent("r%04X_data.u64[%u] = 0x%016" PRIx64 "; /* %g */\n",
                                                                   ^~~~~~
Comment 1 Vinson Lee 2016-11-11 09:08:22 UTC
191d9a5195c0d4871e264a73781dbf8b4368fcb7 is the first bad commit
commit 191d9a5195c0d4871e264a73781dbf8b4368fcb7
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Sep 15 11:36:16 2016 -0700

    glsl: Add a C++ code generator that uses ir_builder to rebuild a program
    
    This is only in libstandalone currently because it will only be used in
    the stand-alone compiler.
    
    v2: Change the signature of the generated function.  The ir_factory is
    created in the generator, and an availability predicate is taken as a
    parameter.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>

:040000 040000 d6b9965d3e1d0d0cb67740302b2c23a3cadc6b93 05efc521b335efa6554f5c8975422cce6b9ee90e M      src
bisect run success
Comment 2 Emil Velikov 2016-11-11 14:18:58 UTC
Should be fixed with

commit d881e1c024bc75025d5752b090f8205cb227c1cd
Author: Brian Paul <brianp@vmware.com>
Date:   Thu Nov 10 17:29:28 2016 -0700

    glsl: include inttypes.h for PRIx64 macro
    
    To fix MinGW build.
    
    Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Comment 3 Brian Paul 2016-11-11 14:35:21 UTC
Actually, this is still failing with our Jenkins build.  Hmm...
Comment 4 Roland Scheidegger 2016-11-11 15:02:33 UTC
(In reply to Brian Paul from comment #3)
> Actually, this is still failing with our Jenkins build.  Hmm...

I've got some feeling this is due this being in c++ code?
Comment 5 Brian Paul 2016-11-11 15:36:57 UTC
(In reply to Roland Scheidegger from comment #4)
> (In reply to Brian Paul from comment #3)
> > Actually, this is still failing with our Jenkins build.  Hmm...
> 
> I've got some feeling this is due this being in c++ code?

Yes.  It looks like this is the first place we've compiled a .cpp file with PRIx64 with MinGW.

My local MinGW build is picking up inttypes.h from /usr/include/inttypes.h but on Jenkins it's picking /usr/i686-w64-mingw32/include/inttypes.h. Don't know why.  In the later, the PRI* macros are not defined for __cplusplus.

It looks like we have to add something like
#ifndef PRIx64
#define PRIx64 "lx"
#endif

in ir_builder_print_visitor.cpp

But then I get additional warnings about the format string and argument type not agreeing.  And defining PRIx64 to "llx" yields other warnings in my test:

pri64.cpp:17:42: warning: unknown conversion type character ‘l’ in format [-Wformat]
pri64.cpp:17:42: warning: too many arguments for format [-Wformat-extra-args]

I think I'll just have to add the #ifndef stuff and live with the warning.
Comment 6 Brian Paul 2016-11-11 18:00:22 UTC
Fixed w/ commit 92ec47a6bad2f1198148dbbab4271d87c5a469a3


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.