[ 
https://issues.apache.org/jira/browse/THRIFT-3063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14388729#comment-14388729
 ] 

James E. King, III commented on THRIFT-3063:
--------------------------------------------

The value in fixing issues like this comes into play when as a project you 
decide to turn warnings into errors, and turn on all warnings.  It makes your 
code more portable, and when not in test code, less confusing to callers of the 
methods (especially when documented properly).  Unless the compiler optimizes 
it away, in high frequency code this would cause inefficiency.  It is test code 
though, so I made it trivial.

> C++ build -Wunused-parameter warnings on processor_test, TransportTest
> ----------------------------------------------------------------------
>
>                 Key: THRIFT-3063
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3063
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9.2
>         Environment: linux, Ubuntu 14.04 LTS
>            Reporter: James E. King, III
>            Priority: Trivial
>
> During a build the following compiler warnings appear:
> {noformat}libtool: link: g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -o 
> .libs/Benchmark Benchmark.o  -L/usr/lib/x86_64-linux-gnu 
> ./.libs/libtestgencpp.a 
> /home/svtbuild/stash/pkgs/thrift2/lib/cpp/.libs/libthrift.so -lssl -lcrypto 
> -lrt -lpthread
> In file included from processor/ServerThread.cpp:22:0:
> processor/ServerThread.h:64:16: warning: unused parameter ‘port’ 
> [-Wunused-parameter]
>    virtual void bindSuccessful(uint16_t port) {
>                 ^
> In file included from processor/ProcessorTest.cpp:39:0:
> processor/ServerThread.h:64:16: warning: unused parameter ‘port’ 
> [-Wunused-parameter]
>    virtual void bindSuccessful(uint16_t port) {
>                 ^
> In file included from processor/ProcessorTest.cpp:40:0:
> processor/Handlers.h:228:16: warning: unused parameter ‘serverContext’ 
> [-Wunused-parameter]
>    virtual void processContext(
>                 ^
> processor/Handlers.h:228:16: warning: unused parameter ‘transport’ 
> [-Wunused-parameter]
> processor/Handlers.h:287:8: warning: unused parameter ‘bytes’ 
> [-Wunused-parameter]
>    void postRead(void* ctx, const char* fnName, uint32_t bytes) {
>         ^
> processor/Handlers.h:301:8: warning: unused parameter ‘bytes’ 
> [-Wunused-parameter]
>    void postWrite(void* ctx, const char* fnName, uint32_t bytes) {
>         ^
> processor/ProcessorTest.cpp:936:24: warning: unused parameter ‘argc’ 
> [-Wunused-parameter]
>  unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
>                         ^
> processor/ProcessorTest.cpp:936:24: warning: unused parameter ‘argv’ 
> [-Wunused-parameter]
> /bin/bash ../../../libtool  --tag=CXX   --mode=link g++ -Wall -Wextra 
> -pedantic -g -O2 -std=c++11 -L/usr/lib/x86_64-linux-gnu  -o processor_test 
> processor/ProcessorTest.o processor/EventLog.o processor/ServerThread.o 
> libprocessortest.la ../../../lib/cpp/libthrift.la 
> ../../../lib/cpp/libthriftnb.la -L/usr/lib/x86_64-linux-gnu -levent 
> -l:libboost_unit_test_framework.a -lssl -lcrypto -lrt -lpthread 
> libtool: link: g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -o 
> .libs/processor_test processor/ProcessorTest.o processor/EventLog.o 
> processor/ServerThread.o  -L/usr/lib/x86_64-linux-gnu 
> ./.libs/libprocessortest.a ../../../lib/cpp/.libs/libthrift.so 
> ../../../lib/cpp/.libs/libthriftnb.so -levent 
> -l:libboost_unit_test_framework.a -lssl -lcrypto -lrt -lpthread{noformat}
> {noformat}
>       g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../../lib/cpp/src/thrift  
> -I/usr/include -I../../../lib/cpp/src  -Wall -Wextra -pedantic -g -O2 
> -std=c++11 -MT TransportTest.o -MD -MP -MF $depbase.Tpo -c -o TransportTest.o 
> TransportTest.cpp &&\
>       mv -f $depbase.Tpo $depbase.Po
> TransportTest.cpp:1048:31: warning: unused parameter ‘argc’ 
> [-Wunused-parameter]
>  boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
>                                ^
> TransportTest.cpp:1048:31: warning: unused parameter ‘argv’ 
> [-Wunused-parameter]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to