gtest_and_gmock.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef TEST_GTEST_AND_GMOCK_H_
  17. #define TEST_GTEST_AND_GMOCK_H_
  18. // This file is used to proxy the include of gtest/gmock headers and suppress
  19. // the warnings generated by that.
  20. // There are two ways we suppress gtest/gmock warnings:
  21. // 1: Using config("test_warning_suppressions") in BUILD.gn
  22. // 2: Via this file.
  23. // 1 applies recursively also to the test translation units, 2 applies only
  24. // to gmock/gtest includes.
  25. #if defined(__GNUC__) // GCC & clang
  26. #pragma GCC diagnostic push
  27. #pragma GCC diagnostic ignored "-Wundef"
  28. #pragma GCC diagnostic ignored "-Wdeprecated"
  29. #pragma GCC diagnostic ignored "-Wmissing-noreturn"
  30. #pragma GCC diagnostic ignored "-Wsign-conversion"
  31. #pragma GCC diagnostic ignored "-Wfloat-equal"
  32. #endif // __GNUC__
  33. #if defined(__clang__)
  34. #pragma GCC diagnostic ignored "-Wshift-sign-overflow"
  35. #pragma GCC diagnostic ignored "-Wcomma"
  36. #endif
  37. #include <gmock/gmock.h>
  38. #include <gtest/gtest.h>
  39. #if defined(__GNUC__)
  40. #pragma GCC diagnostic pop
  41. #endif
  42. #endif // TEST_GTEST_AND_GMOCK_H_