ludocode / mpack

MPack - A C encoder/decoder for the MessagePack serialization format / msgpack.org[C]
MIT License
533 stars 82 forks source link

Tests shadow previous local variable(s) #23

Closed xor-gate closed 8 years ago

xor-gate commented 8 years ago

We are compiling with -Wshadow on GCC 4.8 (also reproducable with clang 3.5):

[ 49%] Building C object 3rdparty/mpack/test/CMakeFiles/mpack_test.dir/test-node.c.o
In file included from 3rdparty/mpack/test/test-node.c:22:0:
3rdparty/mpack/test/test-node.c: In function ‘test_node_read_possible’:
3rdparty/mpack/test/test-node.h:72:18: error: declaration of ‘tree’ shadows a previous local [-Werror=shadow]
     mpack_tree_t tree; \
                  ^
3rdparty/mpack/test/test-node.c:488:5: note: in expansion of macro ‘TEST_SIMPLE_TREE_READ_ERROR’
     TEST_SIMPLE_TREE_READ_ERROR("\xcc", (MPACK_UNUSED(node), true), mpack_error_invalid); // truncated u8
     ^
3rdparty/mpack/test/test-node.c:481:18: error: shadowed declaration is here [-Werror=shadow]
     mpack_tree_t tree;
                  ^
In file included from 3rdparty/mpack/test/test-node.c:22:0:
3rdparty/mpack/test/test-node.h:72:18: error: declaration of ‘tree’ shadows a previous local [-Werror=shadow]
     mpack_tree_t tree; \
                  ^
3rdparty/mpack/test/test-node.c:489:5: note: in expansion of macro ‘TEST_SIMPLE_TREE_READ_ERROR’
     TEST_SIMPLE_TREE_READ_ERROR("\xcd", (MPACK_UNUSED(node), true), mpack_error_invalid); // truncated u16
     ^
3rdparty/mpack/test/test-node.c:481:18: error: shadowed declaration is here [-Werror=shadow]
     mpack_tree_t tree;
                  ^
In file included from 3rdparty/mpack/test/test-node.c:22:0:
3rdparty/mpack/test/test-node.h:72:18: error: declaration of ‘tree’ shadows a previous local [-Werror=shadow]
     mpack_tree_t tree; \
                  ^
3rdparty/mpack/test/test-node.c:490:5: note: in expansion of macro ‘TEST_SIMPLE_TREE_READ_ERROR’
     TEST_SIMPLE_TREE_READ_ERROR("\xce", (MPACK_UNUSED(node), true), mpack_error_invalid); // truncated u32
     ^
3rdparty/mpack/test/test-node.c:481:18: error: shadowed declaration is here [-Werror=shadow]
     mpack_tree_t tree;
                  ^
In file included from 3rdparty/mpack/test/test-node.c:22:0:
3rdparty/mpack/test/test-node.h:72:18: error: declaration of ‘tree’ shadows a previous local [-Werror=shadow]
     mpack_tree_t tree; \
                  ^
3rdparty/mpack/test/test-node.c:491:5: note: in expansion of macro ‘TEST_SIMPLE_TREE_READ_ERROR’
     TEST_SIMPLE_TREE_READ_ERROR("\xcf", (MPACK_UNUSED(node), true), mpack_error_invalid); // truncated u64
     ^
3rdparty/mpack/test/test-node.c:481:18: error: shadowed declaration is here [-Werror=shadow]
     mpack_tree_t tree;
                  ^
cc1: all warnings being treated as errors
make[3]: *** [3rdparty/mpack/test/CMakeFiles/mpack_test.dir/test-node.c.o] Error 1
make[2]: *** [3rdparty/mpack/test/CMakeFiles/mpack_test.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [debug] Error 2