LudovicRousseau / PCSC

pcsc-lite: PC/SC implementation
https://pcsclite.apdu.fr/
Other
268 stars 109 forks source link

pcsc-lite: fix formats under musl #194

Closed neheb closed 4 months ago

neheb commented 4 months ago

pthread_t is a pointer.

LudovicRousseau commented 4 months ago

What is the error message exactly?

pthread_t may be anything.

neheb commented 4 months ago
../src/debuglog.c: In function 'log_line':
../src/debuglog.c:279:40: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'pthread_t' {aka 'struct __pthread *'} [-Werror=format=]
  279 |                                 printf("%s%.8d%s [" THREAD_FORMAT "] %s%s%s, %s%s%s\n",
      |                                        ^~~~~~~~~~~~
  280 |                                         time_pfx, delta, time_sfx, thread_id,
      |                                                                    ~~~~~~~~~
      |                                                                    |
      |                                                                    pthread_t {aka struct __pthread *}
../src/debuglog.c:268:26: note: format string is defined here
  268 | #define THREAD_FORMAT "%lu"
      |                        ~~^
      |                          |
      |                          long unsigned int
../src/debuglog.c:285:40: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'pthread_t' {aka 'struct __pthread *'} [-Werror=format=]
  285 |                                 printf("%s%.8d%s [" THREAD_FORMAT "] %s%s%s\n",
      |                                        ^~~~~~~~~~~~
  286 |                                         time_pfx, delta, time_sfx, thread_id,
      |                                                                    ~~~~~~~~~
      |                                                                    |
      |                                                                    pthread_t {aka struct __pthread *}
../src/debuglog.c:268:26: note: format string is defined here
  268 | #define THREAD_FORMAT "%lu"
      |                        ~~^
      |                          |
      |                          long unsigned int
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
LudovicRousseau commented 4 months ago

Fixed in https://github.com/LudovicRousseau/PCSC/commit/2c82451650e0fe781cee6728c3ceef4cb3161562

Thanks