martinmoene / optional-lite

optional lite - A C++17-like optional, a nullable object for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
403 stars 45 forks source link

Getting rid of `unused parameter ‘lest_env’ [-Werror=unused-parameter]` #26

Closed medithe closed 6 years ago

medithe commented 6 years ago

In the test-file lest_cpp03.hpp, the parameter lest_env may be not used in the expansion of the macro lest_CASE. This happens, when compiling with -Wunused-parameter.

The full warning:

In file included from build/optional-lite-src/test/optional-main.t.h:18,
                 from build/optional-lite-src/test/optional-main.t.cpp:8:
build/optional-lite-src/test/optional-main.t.cpp: In function ‘void __lest_function__26(lest::env&)’:
build/optional-lite-src/test/lest_cpp03.hpp:266:43: error: unused parameter ‘lest_env’ [-Werror=unused-parameter]
     static void lest_FUNCTION(lest::env & lest_env)
                               ~~~~~~~~~~~~^~~~~~~~
build/optional-lite-src/test/optional-main.t.h:22:22: note: in expansion of macro ‘lest_CASE’
 #define CASE( name ) lest_CASE( specification(), name )
                      ^~~~~~~~~
build/optional-lite-src/test/optional-main.t.cpp:26:1: note: in expansion of macro ‘CASE’
 CASE( "__cplusplus" "[.stdc++]" )
martinmoene commented 6 years ago

Thanks @medithe, looks reasonable to me.

Note that env most often is used (review note).

However, please address this to the lest project itself. Afterwards, I'll update the file here

Wonder if the same holds for the C++11 lest.hpp.

medithe commented 6 years ago

Is fixed in d2180bb058a0f6e2837263edbe9b526cd6435303