1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef TEST_GTEST_AND_GMOCK_H_
18 #define TEST_GTEST_AND_GMOCK_H_
19 
20 // This file is used to proxy the include of gtest/gmock headers and suppress
21 // the warnings generated by that.
22 // There are two ways we suppress gtest/gmock warnings:
23 // 1: Using config("test_warning_suppressions") in BUILD.gn
24 // 2: Via this file.
25 // 1 applies recursively also to the test translation units, 2 applies only
26 // to gmock/gtest includes.
27 
28 #if defined(__GNUC__)  // GCC & clang
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wundef"
31 #pragma GCC diagnostic ignored "-Wdeprecated"
32 #pragma GCC diagnostic ignored "-Wmissing-noreturn"
33 #pragma GCC diagnostic ignored "-Wsign-conversion"
34 #pragma GCC diagnostic ignored "-Wfloat-equal"
35 #endif  // __GNUC__
36 
37 #if defined(__clang__)
38 #pragma GCC diagnostic ignored "-Wshift-sign-overflow"
39 #pragma GCC diagnostic ignored "-Wcomma"
40 #endif
41 
42 #include <gmock/gmock.h>
43 #include <gtest/gtest.h>
44 
45 #if defined(__GNUC__)
46 #pragma GCC diagnostic pop
47 #endif
48 
49 #endif  // TEST_GTEST_AND_GMOCK_H_
50