Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning which happen with -O2 flag #19

Open
bogdasar1985 opened this issue Sep 10, 2021 · 1 comment
Open

Fix warning which happen with -O2 flag #19

bogdasar1985 opened this issue Sep 10, 2021 · 1 comment
Labels
important Very important thing

Comments

@bogdasar1985
Copy link
Owner

Fix warnings when compiling with optimization flag level 2 or higher

@bogdasar1985
Copy link
Owner Author

/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/extlibs/bitset.cpp:2:2: warning: #warning Do not use bitset, bug there! [-Wcpp]
[ 16%] Linking CXX static library libbitset.a
[ 16%] Built target bitset
[ 25%] Building CXX object extlibs/CMakeFiles/dynamic_array.dir/dynamic_array.cpp.o
[ 33%] Linking CXX static library libdynamic_array.a
[ 33%] Built target dynamic_array
[ 41%] Building CXX object src/huffman/CMakeFiles/hf_priority_queue.dir/hf_priority_queue.cpp.o
/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/src/huffman/hf_priority_queue.cpp: In member function ‘void hf_priority_queue::deserialize(FILE*, size_t)’:
/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/src/huffman/hf_priority_queue.cpp:103:14: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  103 |         fread(&ch_tmp, sizeof(ch_tmp), 1, fl);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/src/huffman/hf_priority_queue.cpp:104:14: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  104 |         fread(&sz, sizeof(sz), 1, fl);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
[ 50%] Linking CXX static library libhf_priority_queue.a
[ 50%] Built target hf_priority_queue
[ 58%] Building CXX object src/huffman/CMakeFiles/huffman.dir/huffman.cpp.o
[ 66%] Linking CXX static library ../../lib/libhuffman.a
[ 66%] Built target huffman
[ 75%] Building CXX object examples/file_compressor/CMakeFiles/decoder.dir/decoder.cpp.o
/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/examples/file_compressor/decoder.cpp: In function ‘int main(int, char**)’:
/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/examples/file_compressor/decoder.cpp:37:10: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   37 |     fread(&less_bits, sizeof(char), 1, source_fl);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/examples/file_compressor/decoder.cpp:38:10: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   38 |     fread(&pq_size, sizeof(pq_size), 1, source_fl);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/HuffmanCodeLib/examples/file_compressor/decoder.cpp:50:14: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   50 |         fread(&ch, 1, 1, source_fl);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
[ 83%] Linking CXX executable ../../../examples/file_compressor/decoder
[ 83%] Built target decoder
[ 91%] Building CXX object examples/file_compressor/CMakeFiles/coder.dir/coder.cpp.o
[100%] Linking CXX executable ../../../examples/file_compressor/coder
[100%] Built target coder

@bogdasar1985 bogdasar1985 added the important Very important thing label Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
important Very important thing
Projects
None yet
Development

No branches or pull requests

1 participant