xparq/ZipLib

Fix the CLANG warnings

xparq opened this issue · 0 comments

  • extlibs/zlib/inflate.c:1491:61: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
  • extlibs/zlib/...: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  •   include/ZipLib/methods/../compression/lzma/detail/lzma_out_stream.h:40:23: note: 'get_stream' returns a reference
        const stream_t& get_stream() const { return *_stream; }
                        ^
      1 warning generated.
      clang++ -I. -Iinclude -fPIC -std=c++11 -O3 -DZIPLIB_ZLIB -DZIPLIB_BZIP2 -DZIPLIB_LZMA -c src/lib/ZipFile.cpp -o src/lib/ZipFile.
      o
      In file included from src/lib/ZipFile.cpp:1:
      In file included from include/ZipLib/ZipFile.h:2:
      In file included from include/ZipLib/ZipArchive.h:4:
      In file included from include/ZipLib/ZipArchiveEntry.h:8:
      In file included from include/ZipLib/methods/LzmaMethod.h:3:
      include/ZipLib/methods/../compression/lzma/lzma_encoder.h:57:24: warning: reference cannot be bound to dereferenced null pointer
       in well-defined C++ code; comparison may be assumed to always evaluate to true [-Wtautological-undefined-compare]
            return &_ostream.get_stream() != nullptr;
                    ~~~~~~~~~^~~~~~~~~~~~    ~~~~~~~
      include/ZipLib/methods/../compression/lzma/lzma_encoder.h:26:5: note: in instantiation of member function 'basic_lzma_encoder<ch
      ar, std::char_traits<char>>::is_init' requested here
          basic_lzma_encoder()
    

After #8 (-Wall):

  •   /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:151:7: warning: destructor called on non
      -final 'Bzip2Method' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
            __pointer->~_Tp();
            ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:674:9: note: in instantiation of function
       template specialization 'std::_Destroy<Bzip2Method>' requested here
              { std::_Destroy(__p); }
                     ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:613:28: note: in instantiation of func
      tion template specialization 'std::allocator_traits<std::allocator<void>>::destroy<Bzip2Method>' requested here
              allocator_traits<_Alloc>::destroy(_M_impl._M_alloc(), _M_ptr());
                                        ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:599:2: note: in instantiation of membe
      r function 'std::_Sp_counted_ptr_inplace<Bzip2Method, std::allocator<void>, __gnu_cxx::_S_atomic>::_M_dispose' requested here
              _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args)
              ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:972:6: note: in instantiation of funct
      ion template specialization 'std::_Sp_counted_ptr_inplace<Bzip2Method, std::allocator<void>, __gnu_cxx::_S_atomic>::_Sp_counted_
      ptr_inplace<>' requested here
                  _Sp_cp_type(__a._M_a, std::forward<_Args>(__args)...);
                  ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1712:14: note: in instantiation of fun
      ction template specialization 'std::__shared_count<>::__shared_count<Bzip2Method, std::allocator<void>>' requested here
              : _M_ptr(), _M_refcount(_M_ptr, __tag, std::forward<_Args>(__args)...)
                          ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:464:4: note: in instantiation of function t
      emplate specialization 'std::__shared_ptr<Bzip2Method>::__shared_ptr<std::allocator<void>>' requested here
              : __shared_ptr<_Tp>(__tag, std::forward<_Args>(__args)...)
                ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:1009:14: note: in instantiation of function
       template specialization 'std::shared_ptr<Bzip2Method>::shared_ptr<std::allocator<void>>' requested here
            return shared_ptr<_Tp>(_Sp_alloc_shared_tag<_Alloc>{__a},
                   ^
      include/ZipLib/methods/Bzip2Method.h:22:5: note: in instantiation of function template specialization 'std::make_shared<Bzip2Met
      hod>' requested here
          ZIP_METHOD_CLASS_CONSTRUCTOR(Bzip2Method, bzip2_encoder, bzip2_decoder);
          ^
      include/ZipLib/methods/ICompressionMethod.h:16:17: note: expanded from macro 'ZIP_METHOD_CLASS_CONSTRUCTOR'
          return std::make_shared<method_class>();             \
                      ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:151:19: note: qualify call to silence th
      is warning
            __pointer->~_Tp();