Closed mavam closed 8 years ago
Another thing: I'm getting quite a few warnings:
c++ -std=c++11 -stdlib=libc++ -O3 -o benchmark benchmark.cpp bundle/bundle.cpp
bundle/bundle.cpp:53019:2: warning: expression result unused [-Wunused-value]
pFilename; return MZ_FALSE;
^~~~~~~~~
bundle/bundle.cpp:97707:11: warning: enumeration values 'kProfileEOF', 'kProfileCount', and 'kProfileDetect' not handled in switch [-Wswitch]
switch (profile) {
^
bundle/bundle.cpp:98779:26: warning: operator '<<' has lower precedence than '-'; '-' will be evaluated first [-Wshift-op-parentheses]
return p + (1 << shift - 1) >> shift;
~~ ~~~~~~^~~
bundle/bundle.cpp:98779:26: note: place parentheses around the '-' expression to silence this warning
return p + (1 << shift - 1) >> shift;
^
( )
bundle/bundle.cpp:98779:12: warning: operator '>>' has lower precedence than '+'; '+' will be evaluated first [-Wshift-op-parentheses]
return p + (1 << shift - 1) >> shift;
~~^~~~~~~~~~~~~~~~~~ ~~
bundle/bundle.cpp:98779:12: note: place parentheses around the '+' expression to silence this warning
return p + (1 << shift - 1) >> shift;
^
( )
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:103341:10: warning: 4 enumeration values not handled in switch: 'kProfileWave16', 'kProfileEOF', 'kProfileCount'... [-Wswitch]
switch (profile) {
^
bundle/bundle.cpp:103428:10: warning: enumeration values 'kFilterTypeNone', 'kFilterTypeAuto', and 'kFilterTypeCount' not handled in switch [-Wswitch]
switch (filter_) {
^
bundle/bundle.cpp:104039:10: warning: enumeration value 'kProfileCount' not handled in switch [-Wswitch]
switch (pattern) {
^
bundle/bundle.cpp:105543:13: warning: 7 enumeration values not handled in switch: 'kModeUnknown', 'kModeTest', 'kModeOpt'... [-Wswitch]
switch (mode) {
^
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:103888:3: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeTurbo>::processByte<false, BufferedStreamWriter<4096> >' requested here
processByte<false>(sout, c);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:104019:14: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeTurbo>::processByte<true, BufferedStreamReader<4096> >' requested here
size_t c = processByte<true>(sin);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:103888:3: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeFast>::processByte<false, BufferedStreamWriter<4096> >' requested here
processByte<false>(sout, c);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:104019:14: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeFast>::processByte<true, BufferedStreamReader<4096> >' requested here
size_t c = processByte<true>(sin);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:103888:3: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeMid>::processByte<false, BufferedStreamWriter<4096> >' requested here
processByte<false>(sout, c);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:104019:14: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeMid>::processByte<true, BufferedStreamReader<4096> >' requested here
size_t c = processByte<true>(sin);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:103888:3: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeHigh>::processByte<false, BufferedStreamWriter<4096> >' requested here
processByte<false>(sout, c);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:104019:14: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeHigh>::processByte<true, BufferedStreamReader<4096> >' requested here
size_t c = processByte<true>(sin);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:103888:3: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeMax>::processByte<false, BufferedStreamWriter<4096> >' requested here
processByte<false>(sout, c);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:101439:15: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (mm_len = match_model.getLength()) {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bundle/bundle.cpp:104019:14: note: in instantiation of function template specialization 'CM_MCM<CMType::kCMTypeMax>::processByte<true, BufferedStreamReader<4096> >' requested here
size_t c = processByte<true>(sin);
^
bundle/bundle.cpp:101439:15: note: place parentheses around the assignment to silence this warning
if (mm_len = match_model.getLength()) {
^
( )
bundle/bundle.cpp:101439:15: note: use '==' to turn this assignment into an equality comparison
if (mm_len = match_model.getLength()) {
^
==
bundle/bundle.cpp:95615:9: warning: expression result unused [-Wunused-value]
(pos_ < size_);
~~~~ ^ ~~~~~
bundle/bundle.cpp:96299:22: note: in instantiation of member function 'StaticBuffer<unsigned char, 4096>::get' requested here
return out_buffer_.get();
^
bundle/bundle.cpp:96387:2: note: in instantiation of member function 'ByteStreamFilter<4096, 4096>::get' requested here
IdentityFilter(Stream* stream) : ByteStreamFilter(stream) { }
^
bundle/bundle.cpp:95615:9: warning: expression result unused [-Wunused-value]
(pos_ < size_);
~~~~ ^ ~~~~~
bundle/bundle.cpp:96299:22: note: in instantiation of member function 'StaticBuffer<unsigned char, 16384>::get' requested here
return out_buffer_.get();
^
bundle/bundle.cpp:97168:3: note: in instantiation of member function 'ByteStreamFilter<16384, 16384>::get' requested here
Filter(Stream* stream) : ByteStreamFilter(stream), dict_buffer_pos_(0), dict_buffer_size_(4), last_char_(0) {
^
Some of them look like bugs to, e.g., this one:
if (mm_len = match_model.getLength()) {
While you're at it, you may just fix them as well.
Yep, MCM is currently such a mess. I might report some warnings to the original authors though.
I tried using master, but it doesn't compile on Darwin:
The include
malloc.h
is quite Linux-specific and doesn't exist on other platforms. In fact,malloc.h
is depricated since it defines non-standard functions on Linux. In comparison,stdlib.h
(orcstdlib
in C++) defines all malloc-reated functions in a portable way.