nanopolish icon indicating copy to clipboard operation
nanopolish copied to clipboard

compiler warning printf %d vs %lf vs %lu

Open smoe opened this issue 4 years ago • 0 comments

Hello, Please kindly have a look. I presume that the time fixing this pay off easily when there are error reports. :o) Steffen

g++ -o src/nanopolish_call_variants.o -c -g -O2 -fdebug-prefix-map=/home/moeller/git/med-team/nanopolish=. -fstack-protector-strong -Wformat -Werror=format-security -O3 -flto -std=c++11 -fopenmp -fsigned-char -D_FILE_OFFSET_BITS=64  -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/hdf5/serial -I/usr/include/eigen3 -I/usr/include/minimap2   -I/usr/include/minimap2 -I./fast5/include -I./src -I./src/hmm -I./src/thirdparty -I./src/thirdparty/scrappie -I./src/common -I./src/alignment -I./src/pore_model -I./src/io -I./eigen/ -fPIC src/nanopolish_call_variants.cpp
src/nanopolish_call_methylation.cpp: In member function ‘void WatchStatus::update(const string&)’:
src/nanopolish_call_methylation.cpp:120:73: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘double’ [-Wformat=]
  120 |         fprintf(stderr, "\33[2K\r[call-methylation] fast5 progress: %d/%d %.2lfs/fast5 [%s]", processed_fast5s, seconds_per_file, total_fast5s, message.c_str());
      |                                                                        ~^                                       ~~~~~~~~~~~~~~~~
      |                                                                         |                                       |
      |                                                                         int                                     double
      |                                                                        %f
src/nanopolish_call_methylation.cpp:120:79: warning: format ‘%lf’ expects argument of type ‘double’, but argument 5 has type ‘int’ [-Wformat=]
  120 |         fprintf(stderr, "\33[2K\r[call-methylation] fast5 progress: %d/%d %.2lfs/fast5 [%s]", processed_fast5s, seconds_per_file, total_fast5s, message.c_str());
      |                                                                           ~~~~^                                                   ~~~~~~~~~~~~
      |                                                                               |                                                   |
      |                                                                               double                                              int
      |                                                                           %.2d

src/nanopolish_phase_reads.cpp: In function ‘void phase_single_read(const ReadDB&, const faidx_t*, const std::vector<Variant>&, samFile*, const bam_hdr_t*, const bam1_t*, size_t, int, int)’:
src/nanopolish_phase_reads.cpp:313:75: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  313 |                     fprintf(stderr, "warning: reference base at position %d does not match variant record (%c != %c)\n",
      |                                                                          ~^
      |                                                                           |
      |                                                                           int
      |                                                                          %ld
  314 |                         v.ref_position, v.ref_seq[0], read_outseq[out_position]);
      |                         ~~~~~~~~~~~~~~                                     
      |                           |
      |                           size_t {aka long unsigned int}
g++ -o src/nanopolish_polya_estimator.o -c -g -O2 -fdebug-prefix-map=/home/moeller/git/med-team/nanopolish=. -fstack-protector-strong -Wformat -Werror=format-security -O3 -flto -std=c++11 -fopenmp -fsigned-char -D_FILE_OFFSET_BITS=64  -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/hdf5/serial -I/usr/include/eigen3 -I/usr/include/minimap2   -I/usr/include/minimap2 -I./fast5/include -I./src -I./src/hmm -I./src/thirdparty -I./src/thirdparty/scrappie -I./src/common -I./src/alignment -I./src/pore_model -I./src/io -I./eigen/ -fPIC src/nanopolish_polya_estimator.cpp
src/nanopolish_polya_estimator.cpp: In function ‘void estimate_polya_for_single_read(const ReadDB&, const faidx_t*, FILE*, const bam_hdr_t*, const bam1_t*, size_t, int, int)’:
src/nanopolish_polya_estimator.cpp:781:70: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 5 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=]
  781 |         fprintf(stderr, "[polya] read: %s length: %zu prefix clip: %zu suffix clip %zu\n",
      |                                                                    ~~^
      |                                                                      |
      |                                                                      long unsigned int
      |                                                                    %u
  782 |                 read_name.c_str(), sr.read_sequence.length(), prefix_clip, suffix_clip);
      |                                                               ~~~~~~~~~~~
      |                                                               |
      |                                                               uint32_t {aka unsigned int}
src/nanopolish_polya_estimator.cpp:781:86: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 6 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=]
  781 |         fprintf(stderr, "[polya] read: %s length: %zu prefix clip: %zu suffix clip %zu\n",
      |                                                                                    ~~^
      |                                                                                      |
      |                                                                                      long unsigned int
      |                                                                                    %u
  782 |                 read_name.c_str(), sr.read_sequence.length(), prefix_clip, suffix_clip);
      |                                                                            ~~~~~~~~~~~
      |                                                                            |
      |                                                                            uint32_t {aka unsigned int}

smoe avatar May 03 '20 17:05 smoe