1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H
11#define _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H
12
13#include <__config_site>
14#include <__configuration/compiler.h>
15#include <__configuration/utility.h>
16
17#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
18# pragma GCC system_header
19#endif
20
21#ifdef _LIBCPP_COMPILER_CLANG_BASED
22# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
23# define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
24# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str))
25# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
26#elif defined(_LIBCPP_COMPILER_GCC)
27# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
28# define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
29# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
30# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str))
31#else
32# define _LIBCPP_DIAGNOSTIC_PUSH
33# define _LIBCPP_DIAGNOSTIC_POP
34# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
35# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
36#endif
37
38// Macros to enter and leave a state where deprecation warnings are suppressed.
39#define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
40 _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") \
41 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
42#define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP
43
44#endif // _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H
45