• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "perfetto/base/build_config.h"
29 
30 #if defined(__GNUC__)  // GCC & clang
31 #pragma GCC diagnostic push
32 #pragma GCC diagnostic ignored "-Wundef"
33 #pragma GCC diagnostic ignored "-Wdeprecated"
34 #pragma GCC diagnostic ignored "-Wmissing-noreturn"
35 #pragma GCC diagnostic ignored "-Wsign-conversion"
36 #pragma GCC diagnostic ignored "-Wfloat-equal"
37 #endif  // __GNUC__
38 
39 #if defined(__clang__)
40 #pragma GCC diagnostic ignored "-Wshift-sign-overflow"
41 
42 #if !PERFETTO_BUILDFLAG(PERFETTO_OS_NACL)
43 // -Wcomma isn't supported on NaCL.
44 #pragma GCC diagnostic ignored "-Wcomma"
45 #endif  // PERFETTO_OS_NACL
46 
47 #endif
48 
49 #include <gmock/gmock.h>
50 #include <gtest/gtest.h>
51 
52 #if defined(__GNUC__)
53 #pragma GCC diagnostic pop
54 #endif
55 
56 #endif  // TEST_GTEST_AND_GMOCK_H_
57