blob: 3438c0fbacbfbe994c1fdecee41c084add221079 [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
Daniele Di Proiettod43b2972022-09-02 16:52:39 +010030#if defined(__GNUC__) || defined(__clang__)
Primiano Tucci919ca1e2019-08-21 20:26:58 +020031#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"
Daniele Di Proiettod43b2972022-09-02 16:52:39 +010037#endif // defined(__GNUC__) || defined(__clang__)
Primiano Tucci919ca1e2019-08-21 20:26:58 +020038
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
Daniele Di Proiettod43b2972022-09-02 16:52:39 +010047#endif // defined(__clang__)
Primiano Tucci919ca1e2019-08-21 20:26:58 +020048
Lalit Maganti47d8a292024-01-18 20:00:40 +000049#include <gmock/gmock-matchers.h> // IWYU pragma: export
50#include <gmock/gmock-more-matchers.h> // IWYU pragma: export
51#include <gmock/gmock.h> // IWYU pragma: export
52#include <gtest/gtest-matchers.h> // IWYU pragma: export
53#include <gtest/gtest.h> // IWYU pragma: export
Primiano Tucci919ca1e2019-08-21 20:26:58 +020054
Daniele Di Proiettod43b2972022-09-02 16:52:39 +010055#if defined(__GNUC__) || defined(__clang__)
Primiano Tucci919ca1e2019-08-21 20:26:58 +020056#pragma GCC diagnostic pop
57#endif
58
59#endif // TEST_GTEST_AND_GMOCK_H_