[Pcsclite-muscle] Tracing feature in the client side

Ludovic Rousseau ludovic.rousseau
Fri Mar 11 05:01:59 PST 2016


2016-03-11 13:49 GMT+01:00 Maksim Ivanov <emaxx at google.com>:

> Hello Ludovic,
>
> >>
> >> Second, there is an inconsistency between the printf format specifier
> >> and the passed value in the trace function, that produces a warning.
> >> E.g. with clang 3.7.0:
> >>
> >> > 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'
> >> >       (aka 'struct __nc_basic_thread_data *') [-Werror,-Wformat]
> >> >                 direction, pthread_self(), func);
> >> >                            ^~~~~~~~~~~~~~
> >
> >
> > Can you propose a patch for that?
> >
> > pthread_t may not be a numerical value. It may be a structure.
> > http://stackoverflow.com/questions/1759794/how-to-print-pthread-t
>
> I could propose a patch, but in that case we would have to bother with
> licensing (at least, Google Inc. will have to be included into the
> copyright authors list).
>

:-)


> Anyway, I don't have a very nice solution for this problem too.
> Simple, but theoretically non-portable, way would be to cast pthread_t
> to 64-bit integer type (for example, that's how it's done in Chromium
> - as the last-resort solution on the platforms without more useful
> mechanisms: <
> https://cs.chromium.org/#chromium/src/base/threading/platform_thread_posix.cc&l=128
> >
> ).
>

That is also what I had in mind as an easy solution.


> Portable, but tedious, way would be to write a function that dumps the
> passed data byte-by-byte.
>
> IMO, the simplest solution with casting may be enough, as this anyway
> applies to the code that is disabled by default.
>

What version of clang do you use to get this warning?
I used "Debian clang version 3.6.2-3" with -Wformat but did not get this
warning.

Bye

-- 
 Dr. Ludovic Rousseau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20160311/8fccbb24/attachment.html>



More information about the pcsclite-muscle mailing list