[Mesa-dev] [PATCH] gallium/util: Fix debug_printf under Haiku

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 18 14:07:06 UTC 2016


On 18 July 2016 at 14:39, Alexander von Gluck IV <kallisti5 at unixzen.com> wrote:
> July 18 2016 3:29 AM, "Nicolai Hähnle" <nhaehnle at gmail.com> wrote:
>> A comment further up in the same file says
>>
>> /* Haiku provides debug_printf in libroot with OS.h */
>>
>> Is that no longer true?
>>
>> Nicolai
>>
>> On 16.07.2016 16:27, Alexander von Gluck IV wrote:
>>
>>> ---
>>> src/gallium/auxiliary/util/u_debug.h | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
>>> index 7da7f53..7dc4ce8 100644
>>> --- a/src/gallium/auxiliary/util/u_debug.h
>>> +++ b/src/gallium/auxiliary/util/u_debug.h
>>> @@ -83,7 +83,10 @@ _debug_printf(const char *format, ...)
>>> * - avoid outputing large strings (512 bytes is the current maximum length
>>> * that is guaranteed to be printed in all platforms)
>>> */
>>> -#if !defined(PIPE_OS_HAIKU)
>>> +#if defined(PIPE_OS_HAIKU)
>>> +void
>>> +debug_printf(const char *format, ...) _util_printf_format(1,2);
>>> +#else
>>> static inline void
>>> debug_printf(const char *format, ...) _util_printf_format(1,2);
>
Hmm I moved the include further up with commit
373f118c6c750d717fd0727fc3fc191828714c6f although that should not have
made any difference, barring fragile include file order. Can you check
if reverting the u_debug.h gets you up and running ? If so can you
please:
- Please add the stable tag Cc: <mesa-stable at lists.freedesktop.org>
- Attempt to straighten the includes (it might be mesa, llvm and/or
Haiku that is getting confused)

> It's still true, however without the _util_printf_format I get odd llvm
> symbol errors.
>
I would suspect that the above is in play, but without details
(build/error log) little to no one will be able to tell you if this is
the correct fix, I'm afraid.

> The linux code just below defines debug_printf twice as well:
>
> https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/auxiliary/util/u_debug.h#n87
>
AFAICT that is due to the _util_printf_format attribute, which
older/some compilers were not have been happy with [being alongside
the function definition].

> I'm honestly not 100% sure what's going on here as the arguments are the same,
> but defining twice on Haiku (once in OS.h, and again here) seems to resolve the issue.
>
> I have to define it differently under Haiku (and can't use the same one for all platforms)
> because Haiku's debug_printf is not static inline.
>
Would replacing the Haiku one with our static inline work ? Would be
nice if things don't diverge (too much) across platforms.

Just my 2c, as they say.
-Emil


More information about the mesa-dev mailing list