From 8b4ca6256e0c1e1205d3bdad0df14ef6b4f6a49e Mon Sep 17 00:00:00 2001 From: khizmax Date: Fri, 12 May 2017 23:46:39 +0300 Subject: [PATCH] Wrapped gtest/gtest.h into cds_test/ext_gtest.h to suppress GCC 7 warning --- projects/Win/vc141/cds.sln | 3 +- test/include/cds_test/check_size.h | 2 +- test/include/cds_test/ext_gtest.h | 45 +++++++++++++++++++ test/include/cds_test/fixture.h | 6 +-- test/include/cds_test/thread.h | 2 +- test/unit/deque/fcdeque.cpp | 2 +- test/unit/main.cpp | 2 +- test/unit/misc/asan_errors.cpp | 2 +- test/unit/misc/bit_reversal.cpp | 2 +- test/unit/misc/bitop.cpp | 2 +- test/unit/misc/cxx11_atomic_class.cpp | 2 +- test/unit/misc/cxx11_atomic_func.cpp | 2 +- test/unit/misc/hash_tuple.cpp | 2 +- test/unit/misc/permutation_generator.cpp | 2 +- test/unit/misc/split_bitstring.cpp | 2 +- test/unit/queue/fcqueue.cpp | 2 +- test/unit/queue/intrusive_fcqueue.cpp | 2 +- test/unit/stack/fcstack.cpp | 2 +- test/unit/stack/intrusive_fcstack.cpp | 2 +- .../unit/stack/test_intrusive_treiber_stack.h | 2 +- test/unit/stack/test_treiber_stack.h | 2 +- 21 files changed, 66 insertions(+), 24 deletions(-) create mode 100644 test/include/cds_test/ext_gtest.h diff --git a/projects/Win/vc141/cds.sln b/projects/Win/vc141/cds.sln index b96c9484..081f2fdb 100644 --- a/projects/Win/vc141/cds.sln +++ b/projects/Win/vc141/cds.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26228.9 +VisualStudioVersion = 15.0.26430.4 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cds", "cds.vcxproj", "{408FE9BC-44F0-4E6A-89FA-D6F952584239}" EndProject @@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cds_test", "cds_test", "{3A ProjectSection(SolutionItems) = preProject ..\..\..\test\include\cds_test\check_size.h = ..\..\..\test\include\cds_test\check_size.h ..\..\..\test\include\cds_test\city.h = ..\..\..\test\include\cds_test\city.h + ..\..\..\test\include\cds_test\ext_gtest.h = ..\..\..\test\include\cds_test\ext_gtest.h ..\..\..\test\include\cds_test\fc_hevy_value.h = ..\..\..\test\include\cds_test\fc_hevy_value.h ..\..\..\test\include\cds_test\fixture.h = ..\..\..\test\include\cds_test\fixture.h ..\..\..\test\include\cds_test\hash_func.h = ..\..\..\test\include\cds_test\hash_func.h diff --git a/test/include/cds_test/check_size.h b/test/include/cds_test/check_size.h index 326ef986..234b0e00 100644 --- a/test/include/cds_test/check_size.h +++ b/test/include/cds_test/check_size.h @@ -31,7 +31,7 @@ #ifndef CDSTEST_CHECK_SIZE_H #define CDSTEST_CHECK_SIZE_H -#include +#include #include namespace cds_test { diff --git a/test/include/cds_test/ext_gtest.h b/test/include/cds_test/ext_gtest.h new file mode 100644 index 00000000..0d525018 --- /dev/null +++ b/test/include/cds_test/ext_gtest.h @@ -0,0 +1,45 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSTEST_EXT_GTEST_H +#define CDSTEST_EXT_GTEST_H + +#if defined( __GCC__ ) && !defined(__clang__) && __GNUC__ >= 7 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wduplicated-branches" +#endif + +#include + +#if defined( __GCC__ ) && !defined(__clang__) && __GNUC__ >= 7 +# pragma GCC diagnostic pop +#endif + +#endif // #ifndef CDSTEST_EXT_GTEST_H diff --git a/test/include/cds_test/fixture.h b/test/include/cds_test/fixture.h index 6705770e..e09d429b 100644 --- a/test/include/cds_test/fixture.h +++ b/test/include/cds_test/fixture.h @@ -31,14 +31,10 @@ #ifndef CDSTEST_FIXTURE_H #define CDSTEST_FIXTURE_H -#include +#include #include #include -// earlier version of gtest do not support 4th parameter in INSTANTIATE_TEST_CASE_P macro -//TODO: how to known gtest version?.. -//#define CDSTEST_GTEST_INSTANTIATE_TEST_CASE_P_HAS_4TH_ARG - namespace cds_test { class fixture : public ::testing::Test diff --git a/test/include/cds_test/thread.h b/test/include/cds_test/thread.h index fe9e925e..44baffdb 100644 --- a/test/include/cds_test/thread.h +++ b/test/include/cds_test/thread.h @@ -31,7 +31,7 @@ #ifndef CDSTEST_THREAD_H #define CDSTEST_THREAD_H -#include +#include #include #include #include diff --git a/test/unit/deque/fcdeque.cpp b/test/unit/deque/fcdeque.cpp index 0b8fe069..c4d18f2d 100644 --- a/test/unit/deque/fcdeque.cpp +++ b/test/unit/deque/fcdeque.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/test/unit/main.cpp b/test/unit/main.cpp index 6e9fb809..24f9cc59 100644 --- a/test/unit/main.cpp +++ b/test/unit/main.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include int main( int argc, char **argv ) diff --git a/test/unit/misc/asan_errors.cpp b/test/unit/misc/asan_errors.cpp index 17ebaa87..3bea5667 100644 --- a/test/unit/misc/asan_errors.cpp +++ b/test/unit/misc/asan_errors.cpp @@ -30,7 +30,7 @@ #ifdef CDS_ADDRESS_SANITIZER_ENABLED -#include +#include namespace { diff --git a/test/unit/misc/bit_reversal.cpp b/test/unit/misc/bit_reversal.cpp index d583cd54..2c1eb109 100644 --- a/test/unit/misc/bit_reversal.cpp +++ b/test/unit/misc/bit_reversal.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include namespace { diff --git a/test/unit/misc/bitop.cpp b/test/unit/misc/bitop.cpp index 34b7fed1..faca10d1 100644 --- a/test/unit/misc/bitop.cpp +++ b/test/unit/misc/bitop.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include //#include diff --git a/test/unit/misc/cxx11_atomic_class.cpp b/test/unit/misc/cxx11_atomic_class.cpp index d413176c..1f99d513 100644 --- a/test/unit/misc/cxx11_atomic_class.cpp +++ b/test/unit/misc/cxx11_atomic_class.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include "cxx11_convert_memory_order.h" diff --git a/test/unit/misc/cxx11_atomic_func.cpp b/test/unit/misc/cxx11_atomic_func.cpp index 13413d77..432ed4e5 100644 --- a/test/unit/misc/cxx11_atomic_func.cpp +++ b/test/unit/misc/cxx11_atomic_func.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #ifndef CDS_USE_BOOST_ATOMIC diff --git a/test/unit/misc/hash_tuple.cpp b/test/unit/misc/hash_tuple.cpp index aba62d6d..99160bec 100644 --- a/test/unit/misc/hash_tuple.cpp +++ b/test/unit/misc/hash_tuple.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include namespace { diff --git a/test/unit/misc/permutation_generator.cpp b/test/unit/misc/permutation_generator.cpp index 68a164ed..355f2689 100644 --- a/test/unit/misc/permutation_generator.cpp +++ b/test/unit/misc/permutation_generator.cpp @@ -29,7 +29,7 @@ */ #include -#include +#include namespace { diff --git a/test/unit/misc/split_bitstring.cpp b/test/unit/misc/split_bitstring.cpp index 738a6f49..873b1c52 100644 --- a/test/unit/misc/split_bitstring.cpp +++ b/test/unit/misc/split_bitstring.cpp @@ -29,7 +29,7 @@ */ #include -#include +#include namespace { bool is_big_endian() diff --git a/test/unit/queue/fcqueue.cpp b/test/unit/queue/fcqueue.cpp index 1d55ab81..1a05b683 100644 --- a/test/unit/queue/fcqueue.cpp +++ b/test/unit/queue/fcqueue.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/test/unit/queue/intrusive_fcqueue.cpp b/test/unit/queue/intrusive_fcqueue.cpp index fbd74871..f306f7e9 100644 --- a/test/unit/queue/intrusive_fcqueue.cpp +++ b/test/unit/queue/intrusive_fcqueue.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/test/unit/stack/fcstack.cpp b/test/unit/stack/fcstack.cpp index c80f8a77..48d939bf 100644 --- a/test/unit/stack/fcstack.cpp +++ b/test/unit/stack/fcstack.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/test/unit/stack/intrusive_fcstack.cpp b/test/unit/stack/intrusive_fcstack.cpp index b6f272c3..901f216b 100644 --- a/test/unit/stack/intrusive_fcstack.cpp +++ b/test/unit/stack/intrusive_fcstack.cpp @@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/test/unit/stack/test_intrusive_treiber_stack.h b/test/unit/stack/test_intrusive_treiber_stack.h index 6721c934..84565d5e 100644 --- a/test/unit/stack/test_intrusive_treiber_stack.h +++ b/test/unit/stack/test_intrusive_treiber_stack.h @@ -31,7 +31,7 @@ #ifndef CDSUNIT_STACK_INTRUSIVE_TREIBER_STACK_H #define CDSUNIT_STACK_INTRUSIVE_TREIBER_STACK_H -#include +#include #include namespace cds_test { diff --git a/test/unit/stack/test_treiber_stack.h b/test/unit/stack/test_treiber_stack.h index e3bf3ff5..d4dc0706 100644 --- a/test/unit/stack/test_treiber_stack.h +++ b/test/unit/stack/test_treiber_stack.h @@ -31,7 +31,7 @@ #ifndef CDSUNIT_STACK_TREIBER_STACK_H #define CDSUNIT_STACK_TREIBER_STACK_H -#include +#include namespace cds_test { -- 2.34.1