[Bug c++/68669] New: -Wunused-variable is not correctly supressed by #pragmas
pavel.celba at ricardo dot com
gcc-bugzilla@gcc.gnu.org
Thu Dec 3 10:51:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68669
Bug ID: 68669
Summary: -Wunused-variable is not correctly supressed by
#pragmas
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pavel.celba at ricardo dot com
Target Milestone: ---
The GCC version info:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/rs-sync/compilers/gcc/5.1.0/sle11/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/rs-sync/compilers/gcc/5.1.0/sle11
--libdir=/rs-sync/compilers/gcc/5.1.0/sle11/lib64 --enable-lto
--enable-gold=yes --enable-ld=yes
--with-gmp-include=/rs-sync/compilers/gcc/5.1.0/sle11/include
--with-gmp-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64
--with-mpfr-include=/rs-sync/compilers/gcc/5.1.0/sle11/include
--with-mpfr-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64
--with-mpc-include=/rs-sync/compilers/gcc/5.1.0/sle11/include
--with-mpc-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64
--with-ppl-include=/rs-sync/compilers/gcc/5.1.0/sle11/include
--with-ppl-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64
Thread model: posix
gcc version 5.1.0 (GCC)
Including following file from the boost unit test framework - boost version
1.58.0:
#include <boost/test/unit_test.hpp>
and trying to supress unused-variable warnings still produce unused variable
warnings:
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wsign-compare"
#endif
#include <boost/test/unit_test.hpp>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
E.g. from our company unit test code compilation:
In file included from
/store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/unit_test_log.hpp:28:0,
from
/store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/test_tools.hpp:20,
from
/store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/unit_test.hpp:19,
from
/store/prtc-rsfile/pc1/pc1PlasticLinux/cpputils/code/unitTest/../include/cuBoostUnitTestHeaderInclude.h:20,
from
/store/prtc-rsfile/pc1/pc1PlasticLinux/cpputils/code/unitTest/src/run_tests.cpp:2:
/store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/unit_test_log.hpp:134:28:
warning: âboost::unit_test::{anonymous}::unit_test_logâ defined but not used
[-Wunused-variable]
BOOST_TEST_SINGLETON_INST( unit_test_log )
^
/store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/utils/trivial_singleton.hpp:64:36:
note: in definition of macro âBOOST_TEST_SINGLETON_INSTâ
namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); }
FYI - run_tests.cpp is exactly this:
#define BOOST_TEST_MODULE cpputils_tests test
#include "cuBoostUnitTestHeaderInclude.h"
More information about the Gcc-bugs
mailing list