Assorted compiler warnings/errors #86

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

Originally created by @jeroen on GitHub (Jan 24, 2016).

Some compiler warnings:

gcc with c++98 on Fedora

g++ -I/data/gannet/ripley/R/R-devel/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O2 -Wall -pedantic -mtune=native  -c enc/streams.cc -o enc/streams.o
In file included from enc/encode.h:15:0,
                 from wrapper.cc:3:
enc/./hash.h:102:17: warning: invoking macro length argument 1: empty macro arguments are undefined in ISO C++98 [-Wpedantic]
   size_t length() const {
                 ^
enc/./hash.h:107:33: warning: invoking macro length argument 1: empty macro arguments are undefined in ISO C++98 [-Wpedantic]
     return code ? code : length();
                                 ^

clang on Fedora

enc/brotli_bit_stream.cc:337:33: error: use of undeclared identifier 'malloc'
      static_cast<HuffmanTree*>(malloc(max_tree_size * sizeof(HuffmanTree)));
                                ^
enc/brotli_bit_stream.cc:398:3: error: use of undeclared identifier 'free'
  free(tree);
  ^
2 errors generated.
/data/gannet/ripley/R/R-clang/etc/Makeconf:139: recipe for target 'enc/brotli_bit_stream.o' failed
make[1]: *** [enc/brotli_bit_stream.o] Error 1
enc/encode.cc:260:3: error: use of undeclared identifier 'free'
  free(commands_);
  ^
enc/encode.cc:391:31: error: use of undeclared identifier 'realloc'
        static_cast<Command*>(realloc(commands_, sizeof(Command) * newsize));
                              ^
2 errors generated.
/data/gannet/ripley/R/R-clang/etc/Makeconf:139: recipe for target 'enc/encode.o' failed
make[1]: *** [enc/encode.o] Error 1
enc/encode_parallel.cc:99:7: error: use of undeclared identifier 'malloc'
      malloc(sizeof(Command) * ((input_size + 1) >> 1)));
      ^
enc/encode_parallel.cc:175:3: error: use of undeclared identifier 'free'
  free(commands);
  ^
2 errors generated.

Solaris Studio 12.3

cc -xc99 -I/home/ripley/R/cc/include -DNDEBUG  -I/usr/local/include   -DBROTLI_BUILD_PORTABLE -include config.h -KPIC  -O -xlibmieee -xtarget=native  -c dec/decode.c -o dec/decode.o
"dec/decode.c", line 1205: warning: statement not reached

gcc 4.6.3 on Windows

enc/encode.cc -o enc/encode.o
enc/encode.cc: In member function 'bool brotli::BrotliCompressor::WriteBrotliData(bool, bool, size_t*, uint8_t**)':
enc/encode.cc:409:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Solaris
Lots of these: https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/brotli-00install.html

Originally created by @jeroen on GitHub (Jan 24, 2016). Some compiler warnings: **gcc with c++98 on Fedora** ``` g++ -I/data/gannet/ripley/R/R-devel/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -Wall -pedantic -mtune=native -c enc/streams.cc -o enc/streams.o In file included from enc/encode.h:15:0, from wrapper.cc:3: enc/./hash.h:102:17: warning: invoking macro length argument 1: empty macro arguments are undefined in ISO C++98 [-Wpedantic] size_t length() const { ^ enc/./hash.h:107:33: warning: invoking macro length argument 1: empty macro arguments are undefined in ISO C++98 [-Wpedantic] return code ? code : length(); ^ ``` **clang on Fedora** ``` enc/brotli_bit_stream.cc:337:33: error: use of undeclared identifier 'malloc' static_cast<HuffmanTree*>(malloc(max_tree_size * sizeof(HuffmanTree))); ^ enc/brotli_bit_stream.cc:398:3: error: use of undeclared identifier 'free' free(tree); ^ 2 errors generated. /data/gannet/ripley/R/R-clang/etc/Makeconf:139: recipe for target 'enc/brotli_bit_stream.o' failed make[1]: *** [enc/brotli_bit_stream.o] Error 1 enc/encode.cc:260:3: error: use of undeclared identifier 'free' free(commands_); ^ enc/encode.cc:391:31: error: use of undeclared identifier 'realloc' static_cast<Command*>(realloc(commands_, sizeof(Command) * newsize)); ^ 2 errors generated. /data/gannet/ripley/R/R-clang/etc/Makeconf:139: recipe for target 'enc/encode.o' failed make[1]: *** [enc/encode.o] Error 1 enc/encode_parallel.cc:99:7: error: use of undeclared identifier 'malloc' malloc(sizeof(Command) * ((input_size + 1) >> 1))); ^ enc/encode_parallel.cc:175:3: error: use of undeclared identifier 'free' free(commands); ^ 2 errors generated. ``` **Solaris Studio 12.3** ``` cc -xc99 -I/home/ripley/R/cc/include -DNDEBUG -I/usr/local/include -DBROTLI_BUILD_PORTABLE -include config.h -KPIC -O -xlibmieee -xtarget=native -c dec/decode.c -o dec/decode.o "dec/decode.c", line 1205: warning: statement not reached ``` **gcc 4.6.3 on Windows** ``` enc/encode.cc -o enc/encode.o enc/encode.cc: In member function 'bool brotli::BrotliCompressor::WriteBrotliData(bool, bool, size_t*, uint8_t**)': enc/encode.cc:409:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ``` **Solaris** Lots of these: https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/brotli-00install.html
Author
Owner

@eustas commented on GitHub (Jan 25, 2016):

Thank you for your research and report. We are going to fix those warnings soon.

@eustas commented on GitHub (Jan 25, 2016): Thank you for your research and report. We are going to fix those warnings soon.
Author
Owner

@jeroen commented on GitHub (Jan 25, 2016):

Thank you. Let me know if I can help test something.

Full build logs are here by the way: https://cran.r-project.org/web/checks/check_results_brotli.html

@jeroen commented on GitHub (Jan 25, 2016): Thank you. Let me know if I can help test something. Full build logs are here by the way: https://cran.r-project.org/web/checks/check_results_brotli.html
Author
Owner

@jeroen commented on GitHub (Feb 2, 2016):

Any updates? Need to fix these issues downstream...

@jeroen commented on GitHub (Feb 2, 2016): Any updates? Need to fix these issues downstream...
Author
Owner

@kazuho commented on GitHub (Feb 29, 2016):

FWIW this causes compile error on FreeBSD 10 (ref: https://github.com/h2o/h2o/issues/815).

@kazuho commented on GitHub (Feb 29, 2016): FWIW this causes compile error on FreeBSD 10 (ref: https://github.com/h2o/h2o/issues/815).
Author
Owner

@eustas commented on GitHub (Feb 29, 2016):

Ooops. We've fixed this in internal repo, but still hasn't publised the fix. Going to do it ASAP.

@eustas commented on GitHub (Feb 29, 2016): Ooops. We've fixed this in internal repo, but still hasn't publised the fix. Going to do it ASAP.
Author
Owner

@eustas commented on GitHub (Feb 29, 2016):

PR #323

@eustas commented on GitHub (Feb 29, 2016): PR #323
Author
Owner

@eustas commented on GitHub (Feb 29, 2016):

Hi. Could you check again (PR #323 just landed).

@eustas commented on GitHub (Feb 29, 2016): Hi. Could you check again (PR #323 just landed).
Author
Owner

@jeroen commented on GitHub (Feb 29, 2016):

Still getting a warning in C++98:

g++ -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -Wno-unused -pedantic  -c wrappe
r.cc -o wrapper.o
In file included from enc/encode.h:15:0,
                 from wrapper.cc:3:
enc/./hash.h:111:33: warning: invoking macro length argument 1: empty macro arguments are undefined in ISO C90 and ISO C++98 [enabled by default]
     return code ? code : length();
                                 ^

And:

"dec/decode.c", line 1251: warning: statement not reached
@jeroen commented on GitHub (Feb 29, 2016): Still getting a warning in C++98: ``` g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -O3 -Wall -pipe -Wno-unused -pedantic -c wrappe r.cc -o wrapper.o In file included from enc/encode.h:15:0, from wrapper.cc:3: enc/./hash.h:111:33: warning: invoking macro length argument 1: empty macro arguments are undefined in ISO C90 and ISO C++98 [enabled by default] return code ? code : length(); ^ ``` And: ``` "dec/decode.c", line 1251: warning: statement not reached ```
Author
Owner

@eustas commented on GitHub (Feb 29, 2016):

The decoder thing seems to be easy to fix.
But brotli doesn't have a macro "length". Do you know where it is defined?

@eustas commented on GitHub (Feb 29, 2016): The decoder thing seems to be easy to fix. But brotli doesn't have a macro "length". Do you know where it is defined?
Author
Owner

@jeroen commented on GitHub (Feb 29, 2016):

Oh that might be in my bindings actually. Sorry for that...

@jeroen commented on GitHub (Feb 29, 2016): Oh that might be in my bindings actually. Sorry for that...
Author
Owner

@eustas commented on GitHub (Feb 29, 2016):

No worries, we are going to try to decouple our header files, so embedder code doesn't reach hash.h from encode.h

@eustas commented on GitHub (Feb 29, 2016): No worries, we are going to try to decouple our header files, so embedder code doesn't reach hash.h from encode.h
Author
Owner

@jeroen commented on GitHub (Feb 29, 2016):

Thanks yes I was including a header file before brotli which apparently had a length() macro. Not sure if there is a sensible way to avoid such problems.

I am opening a separate issue for Solaris problems.

@jeroen commented on GitHub (Feb 29, 2016): Thanks yes I was including a header file before brotli which apparently had a `length()` macro. Not sure if there is a sensible way to avoid such problems. I am opening a separate issue for Solaris problems.
Author
Owner

@eustas commented on GitHub (Jun 16, 2016):

Hey, we've updated encoder recently -> many problems should be fixed by now.
If not, feel free to reopen the issue.

@eustas commented on GitHub (Jun 16, 2016): Hey, we've updated encoder recently -> many problems should be fixed by now. If not, feel free to reopen the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#86