Compiler warnings #24

Closed
opened 2026-01-29 20:29:13 +00:00 by claunia · 3 comments
Owner

Originally created by @jeroen on GitHub (Sep 22, 2015).

I am writing bindings which should be portable across platforms and work with older compilers. Is there a way to fix the warnings below (without suppressing them)?

clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -Ienc -Idec -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include   -std=c++11 -fPIC  -Wall -mtune=core2 -g -O2  -c enc/metablock.cc -o enc/metablock.o
In file included from enc/metablock.cc:18:
enc/./metablock.h:28:1: warning: 'BlockSplit' defined as a struct here but previously declared as a class [-Wmismatched-tags]
struct BlockSplit {
^
enc/./histogram.h:30:1: note: did you mean struct here?
class BlockSplit;
^~~~~
struct

Also a few warnings about c++11 extensions. Is there a way to work around these for older compilers?

In file included from enc/encode_parallel.cc:17:
In file included from enc/./encode_parallel.h:25:
In file included from enc/./encode.h:28:
enc/./streams.h:59:46: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  const void* Read(size_t n, size_t* OUTPUT) override;
                                             ^
enc/./streams.h:77:41: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  bool Write(const void* buf, size_t n) override;
                                        ^
enc/./streams.h:95:41: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  bool Write(const void* buf, size_t n) override;
                                        ^
enc/./streams.h:108:50: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  const void* Read(size_t n, size_t* bytes_read) override;
                                                 ^
enc/./streams.h:121:41: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  bool Write(const void* buf, size_t n) override;
                                        ^

On Ubuntu 14.04:

g++ -I/usr/share/R/include -DNDEBUG -Ienc -Idec     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c enc/backward_references.cc -o enc/backward_references.o
In file included from enc/./backward_references.h:23:0,
                from enc/backward_references.cc:17:
enc/././hash.h:673:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H1> hash_h1;
  ^
enc/././hash.h:674:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H2> hash_h2;
  ^
enc/././hash.h:675:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H3> hash_h3;
  ^
enc/././hash.h:676:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H4> hash_h4;
  ^
enc/././hash.h:677:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H5> hash_h5;
  ^
enc/././hash.h:678:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H6> hash_h6;
  ^
enc/././hash.h:679:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H7> hash_h7;
  ^
enc/././hash.h:680:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H8> hash_h8;
  ^
enc/././hash.h:681:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
  std::unique_ptr<H9> hash_h9;
  ^
enc/././hash.h: In member function ‘void brotli::Hashers::Init(int)’:
enc/././hash.h:636:15: error: ‘hash_h1’ was not declared in this scope
      case 1: hash_h1.reset(new H1); break;
              ^
enc/././hash.h:637:15: error: ‘hash_h2’ was not declared in this scope
      case 2: hash_h2.reset(new H2); break;
              ^
enc/././hash.h:638:15: error: ‘hash_h3’ was not declared in this scope
      case 3: hash_h3.reset(new H3); break;
              ^
enc/././hash.h:639:15: error: ‘hash_h4’ was not declared in this scope
      case 4: hash_h4.reset(new H4); break;
              ^
enc/././hash.h:640:15: error: ‘hash_h5’ was not declared in this scope
      case 5: hash_h5.reset(new H5); break;
              ^
enc/././hash.h:641:15: error: ‘hash_h6’ was not declared in this scope
      case 6: hash_h6.reset(new H6); break;
              ^
enc/././hash.h:642:15: error: ‘hash_h7’ was not declared in this scope
      case 7: hash_h7.reset(new H7); break;
              ^
enc/././hash.h:643:15: error: ‘hash_h8’ was not declared in this scope
      case 8: hash_h8.reset(new H8); break;
              ^
enc/././hash.h:644:15: error: ‘hash_h9’ was not declared in this scope
      case 9: hash_h9.reset(new H9); break;
              ^
Originally created by @jeroen on GitHub (Sep 22, 2015). I am writing bindings which should be portable across platforms and work with older compilers. Is there a way to fix the warnings below (without suppressing them)? ``` clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -Ienc -Idec -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -std=c++11 -fPIC -Wall -mtune=core2 -g -O2 -c enc/metablock.cc -o enc/metablock.o In file included from enc/metablock.cc:18: enc/./metablock.h:28:1: warning: 'BlockSplit' defined as a struct here but previously declared as a class [-Wmismatched-tags] struct BlockSplit { ^ enc/./histogram.h:30:1: note: did you mean struct here? class BlockSplit; ^~~~~ struct ``` Also a few warnings about c++11 extensions. Is there a way to work around these for older compilers? ``` In file included from enc/encode_parallel.cc:17: In file included from enc/./encode_parallel.h:25: In file included from enc/./encode.h:28: enc/./streams.h:59:46: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] const void* Read(size_t n, size_t* OUTPUT) override; ^ enc/./streams.h:77:41: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] bool Write(const void* buf, size_t n) override; ^ enc/./streams.h:95:41: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] bool Write(const void* buf, size_t n) override; ^ enc/./streams.h:108:50: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] const void* Read(size_t n, size_t* bytes_read) override; ^ enc/./streams.h:121:41: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] bool Write(const void* buf, size_t n) override; ^ ``` On Ubuntu 14.04: ``` g++ -I/usr/share/R/include -DNDEBUG -Ienc -Idec -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c enc/backward_references.cc -o enc/backward_references.o In file included from enc/./backward_references.h:23:0, from enc/backward_references.cc:17: enc/././hash.h:673:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H1> hash_h1; ^ enc/././hash.h:674:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H2> hash_h2; ^ enc/././hash.h:675:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H3> hash_h3; ^ enc/././hash.h:676:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H4> hash_h4; ^ enc/././hash.h:677:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H5> hash_h5; ^ enc/././hash.h:678:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H6> hash_h6; ^ enc/././hash.h:679:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H7> hash_h7; ^ enc/././hash.h:680:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H8> hash_h8; ^ enc/././hash.h:681:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type std::unique_ptr<H9> hash_h9; ^ enc/././hash.h: In member function ‘void brotli::Hashers::Init(int)’: enc/././hash.h:636:15: error: ‘hash_h1’ was not declared in this scope case 1: hash_h1.reset(new H1); break; ^ enc/././hash.h:637:15: error: ‘hash_h2’ was not declared in this scope case 2: hash_h2.reset(new H2); break; ^ enc/././hash.h:638:15: error: ‘hash_h3’ was not declared in this scope case 3: hash_h3.reset(new H3); break; ^ enc/././hash.h:639:15: error: ‘hash_h4’ was not declared in this scope case 4: hash_h4.reset(new H4); break; ^ enc/././hash.h:640:15: error: ‘hash_h5’ was not declared in this scope case 5: hash_h5.reset(new H5); break; ^ enc/././hash.h:641:15: error: ‘hash_h6’ was not declared in this scope case 6: hash_h6.reset(new H6); break; ^ enc/././hash.h:642:15: error: ‘hash_h7’ was not declared in this scope case 7: hash_h7.reset(new H7); break; ^ enc/././hash.h:643:15: error: ‘hash_h8’ was not declared in this scope case 8: hash_h8.reset(new H8); break; ^ enc/././hash.h:644:15: error: ‘hash_h9’ was not declared in this scope case 9: hash_h9.reset(new H9); break; ^ ```
Author
Owner

@lvandeve commented on GitHub (Sep 23, 2015):

Hello,

Thank you for the report. We'll fix the struct/class mismatch soon. In addition, indeed we're planning to support C++98 with the encoder, also on the way soon.

@lvandeve commented on GitHub (Sep 23, 2015): Hello, Thank you for the report. We'll fix the struct/class mismatch soon. In addition, indeed we're planning to support C++98 with the encoder, also on the way soon.
Author
Owner

@szabadka commented on GitHub (Oct 1, 2015):

These should be fixed with PR #186

@szabadka commented on GitHub (Oct 1, 2015): These should be fixed with PR #186
Author
Owner

@jeroen commented on GitHub (Oct 1, 2015):

Yay thank you!

@jeroen commented on GitHub (Oct 1, 2015): Yay thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#24