torognes / vsearch

Versatile open-source tool for microbiome analysis
Other
643 stars 123 forks source link

fix two GCC 10.2 format warnings #471

Closed frederic-mahe closed 2 years ago

frederic-mahe commented 2 years ago
derep.cc:974:21: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘long long unsigned int’ [-Wformat=]
  974 |                     "%s\t%s%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%u\t%s\n",
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  975 |                     hh, opt_relabel, i + 1, i, 0ULL, bp->count, hh);
      |                                                ~~~~
      |                                                |
      |                                                long long unsigned int
derep.cc:978:21: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long unsigned int’ [-Wformat=]
  978 |                     "%s\t%s\t%" PRIu64 "\t%" PRIu64 "\t%u\t%s\n",
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  979 |                     hh, hh, i, 0ULL, bp->count, hh);
      |                                ~~~~
      |                                |
      |                                long long unsigned int
torognes commented 2 years ago

Thanks for the contribution, but this causes the opposite problem on macOS and Windows:

derep.cc: In function ‘void derep(char*, bool)’:
derep.cc:974:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 7 has type ‘long unsigned int’ [-Wformat=]
                     "%s\t%s%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%u\t%s\n",
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
derep.cc:978:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]
                     "%s\t%s\t%" PRIu64 "\t%" PRIu64 "\t%u\t%s\n",
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looking to find a way to specify a zero constant in PRIu64... :-)

frederic-mahe commented 2 years ago

issue fixed using (unit64) type casting.