<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-03-11 13:49 GMT+01:00 Maksim Ivanov <span dir="ltr"><<a href="mailto:emaxx@google.com" target="_blank">emaxx@google.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Ludovic,<br>
<span class=""><br>
>><br>
>> Second, there is an inconsistency between the printf format specifier<br>
>> and the passed value in the trace function, that produces a warning.<br>
>> E.g. with clang 3.7.0:<br>
>><br>
>> > pcsc-lite/src-1.8.15/src/winscard_clnt.c:162:14: error: format specifies type 'unsigned long' but the argument has type 'pthread_t'<br>
>> > (aka 'struct __nc_basic_thread_data *') [-Werror,-Wformat]<br>
>> > direction, pthread_self(), func);<br>
>> > ^~~~~~~~~~~~~~<br>
><br>
><br>
> Can you propose a patch for that?<br>
><br>
> pthread_t may not be a numerical value. It may be a structure.<br>
> <a href="http://stackoverflow.com/questions/1759794/how-to-print-pthread-t" rel="noreferrer" target="_blank">http://stackoverflow.com/questions/1759794/how-to-print-pthread-t</a><br>
<br>
</span>I could propose a patch, but in that case we would have to bother with<br>
licensing (at least, Google Inc. will have to be included into the<br>
copyright authors list).<br></blockquote><div><br>:-)<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Anyway, I don't have a very nice solution for this problem too.<br>
Simple, but theoretically non-portable, way would be to cast pthread_t<br>
to 64-bit integer type (for example, that's how it's done in Chromium<br>
- as the last-resort solution on the platforms without more useful<br>
mechanisms: <<a href="https://cs.chromium.org/#chromium/src/base/threading/platform_thread_posix.cc&l=128" rel="noreferrer" target="_blank">https://cs.chromium.org/#chromium/src/base/threading/platform_thread_posix.cc&l=128</a>><br>
).<br></blockquote><div><br></div><div>That is also what I had in mind as an easy solution.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Portable, but tedious, way would be to write a function that dumps the<br>
passed data byte-by-byte.<br>
<br>
IMO, the simplest solution with casting may be enough, as this anyway<br>
applies to the code that is disabled by default.<br></blockquote><div><br></div><div>What version of clang do you use to get this warning?<br></div><div>I used "Debian clang version 3.6.2-3" with -Wformat but did not get this warning.<br><br></div><div>Bye<br clear="all"></div></div><br>-- <br><div class="gmail_signature"> Dr. Ludovic Rousseau</div>
</div></div>