blob: 82918d8a0c5447fdbff4ed99e5c7cfd9ec04ec53 [file] [log] [blame]
Primiano Tucci919ca1e2019-08-21 20:26:58 +02001/*
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
Alexander Timin597658e2021-03-01 14:07:22 +000028#include "perfetto/base/build_config.h"
29
Primiano Tucci919ca1e2019-08-21 20:26:58 +020030#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"
Eric Seckler063ed392020-04-03 18:26:30 +010036#pragma GCC diagnostic ignored "-Wfloat-equal"
Primiano Tucci919ca1e2019-08-21 20:26:58 +020037#endif // __GNUC__
38
39#if defined(__clang__)
40#pragma GCC diagnostic ignored "-Wshift-sign-overflow"
Alexander Timin597658e2021-03-01 14:07:22 +000041
42#if !PERFETTO_BUILDFLAG(PERFETTO_OS_NACL)
43// -Wcomma isn't supported on NaCL.
Primiano Tucci919ca1e2019-08-21 20:26:58 +020044#pragma GCC diagnostic ignored "-Wcomma"
Alexander Timin597658e2021-03-01 14:07:22 +000045#endif // PERFETTO_OS_NACL
46
Primiano Tucci919ca1e2019-08-21 20:26:58 +020047#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_