xref: /freebsd/lib/clang/include/llvm/Config/abi-breaking.h (revision 13464e4a44fc58490a03bb8bfc7e3c972e9c30b2)
1 /* $FreeBSD$ */
2 /*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/
3 /*                                                                            */
4 /*                     The LLVM Compiler Infrastructure                       */
5 /*                                                                            */
6 /* This file is distributed under the University of Illinois Open Source      */
7 /* License. See LICENSE.TXT for details.                                      */
8 /*                                                                            */
9 /*===----------------------------------------------------------------------===*/
10 
11 /* This file controls the C++ ABI break introduced in LLVM public header. */
12 
13 #ifndef LLVM_ABI_BREAKING_CHECKS_H
14 #define LLVM_ABI_BREAKING_CHECKS_H
15 
16 /* Define to enable checks that alter the LLVM C++ ABI */
17 #define LLVM_ENABLE_ABI_BREAKING_CHECKS 1
18 
19 /* Define to disable the link-time checking of mismatch for
20    LLVM_ENABLE_ABI_BREAKING_CHECKS */
21 #define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 0
22 #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
23 
24 // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
25 // mismatch with LLVM
26 #if defined(_MSC_VER)
27 // Use pragma with MSVC
28 #define LLVM_XSTR(s) LLVM_STR(s)
29 #define LLVM_STR(s) #s
30 #pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
31 #undef LLVM_XSTR
32 #undef LLVM_STR
33 #elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
34 // FIXME: Implement checks without weak.
35 #elif defined(__cplusplus)
36 namespace llvm {
37 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
38 extern int EnableABIBreakingChecks;
39 __attribute__((weak, visibility ("hidden"))) int *VerifyEnableABIBreakingChecks = &EnableABIBreakingChecks;
40 #else
41 extern int DisableABIBreakingChecks;
42 __attribute__((weak, visibility ("hidden"))) int *VerifyDisableABIBreakingChecks = &DisableABIBreakingChecks;
43 #endif
44 }
45 #endif // _MSC_VER
46 
47 #endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
48 
49 #endif
50