#define BOOST_AUTO_TEST_CASE(...) void BOOST_AUTO_TEST_CASE_run(__VA_ARGS__)
int x = 1; // file-scope declaration before first test case
BOOST_AUTO_TEST_CASE( test_one )
{
x = 2;
}
test_b.cpp -- no warning:
#define BOOST_AUTO_TEST_CASE(...) void BOOST_AUTO_TEST_CASE_run(__VA_ARGS__)
BOOST_AUTO_TEST_CASE( test_one )
{
int x = 1;
}
Expected: consistent behaviour -- either both warned or neither.
Observed: only test_a.cpp triggers [unusedFunction] for
BOOST_AUTO_TEST_CASE_run.
Root cause: the boost.cfg expansion void BOOST_AUTO_TEST_CASE_run(__VA_ARGS__) collapses
all test cases to the same function name.
The inconsistency between files appears to depend on whether file-scope
declarations precede the first macro invocation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
test_a.cpp -- triggers warning:
test_b.cpp -- no warning:
Command:
Expected: consistent behaviour -- either both warned or neither.
Observed: only test_a.cpp triggers [unusedFunction] for
BOOST_AUTO_TEST_CASE_run.
Root cause: the boost.cfg expansion
void BOOST_AUTO_TEST_CASE_run(__VA_ARGS__)collapsesall test cases to the same function name.
The inconsistency between files appears to depend on whether file-scope
declarations precede the first macro invocation.