refresh-bio / KMC

Fast and frugal disk based k-mer counter
256 stars 73 forks source link

Warning in compilation of kmc_api/kmc_file.cpp #119

Closed voichek closed 5 years ago

voichek commented 5 years ago

Hi,

I was wondering if you could fix this warning I am getting when I compile kmc_api? ` include/KMC/kmc_api/kmc_file.cpp: In member function 'void CKMCFile::Reload_sufix_file_buf()': include/KMC/kmc_api/kmc_file.cpp:609:8: warning: ignoring return value of 'size_t fread(void, size_t, size_t, FILE)', declared with attribute warn_unused_result [-Wunused-result] fread (sufix_file_buf, 1, (size_t) part_size, file_suf);


include/KMC/kmc_api/kmc_file.cpp: In member function 'bool CKMCFile::RestartListing()':
include/KMC/kmc_api/kmc_file.cpp:655:9: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   fread (sufix_file_buf, 1, (size_t) part_size, file_suf);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`

Thanks for the help,
Yoav
marekkokot commented 5 years ago

Hi,

I have tried a couple of gcc versions and none of them shows this warning. Anyway I think it should be fixed with 89fcd81. Let me know if it is and what compiler do you use. Thanks

voichek commented 5 years ago

Hi,

Thanks for the help! The update fixed the first warning but not the second one. I still get: nclude/KMC/kmc_api/kmc_file.cpp: In member function ‘bool CKMCFile::RestartListing()’: include/KMC/kmc_api/kmc_file.cpp:669:9: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result] fread (sufix_file_buf, 1, (size_t) part_size, file_suf); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is my command in g++ g++ -std=c++14 -Wall -O3 -I ./include/ -pthread -msse4.2 -march=native -MMD -c include/KMC/kmc_api/kmc_file.cpp -o build/kmc_file.o

Version: $ g++ --version g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

Sorry to nag you on a warning massage, I am a bit pedantic.

Best wishes, Yoav

marekkokot commented 5 years ago

Hi, thanks, I didn't use g++ 7.3.0, although I have tried 8.2.0. My compiler does not show this warning, I don't know why, because I think it should. Nevertheless, 2183fc4 should fix that (in fact the previous commit could break kmc api without the piece of code I just added). If it is OK now, please close this issue. Thanks!

voichek commented 5 years ago

No warnings anymore, thanks!