xref: /freebsd/contrib/llvm-project/llvm/include/llvm-c/Deprecated.h (revision 0eae32dcef82f6f06de6419a0d623d7def0cc8f6)
1 /*===-- llvm-c/Deprecated.h - Deprecation macro -------------------*- C -*-===*\
2 |*                                                                            *|
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
4 |* 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 |* This header declares LLVM_ATTRIBUTE_C_DEPRECATED() macro, which can be     *|
11 |* used to deprecate functions in the C interface.                            *|
12 |*                                                                            *|
13 \*===----------------------------------------------------------------------===*/
14 
15 #ifndef LLVM_C_DEPRECATED_H
16 #define LLVM_C_DEPRECATED_H
17 
18 #ifndef __has_feature
19 # define __has_feature(x) 0
20 #endif
21 
22 // This is a variant of LLVM_ATTRIBUTE_DEPRECATED() that is compatible with
23 // C compilers.
24 #if __has_feature(attribute_deprecated_with_message)
25 # define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
26   decl __attribute__((deprecated(message)))
27 #elif defined(__GNUC__)
28 # define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
29   decl __attribute__((deprecated))
30 #elif defined(_MSC_VER)
31 # define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
32   __declspec(deprecated(message)) decl
33 #else
34 # define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
35   decl
36 #endif
37 
38 #endif /* LLVM_C_DEPRECATED_H */
39