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 enable reverse iteration of unordered llvm containers */
20 #define LLVM_ENABLE_REVERSE_ITERATION 0
21 
22 /* Allow selectively disabling link-time mismatch checking so that header-only
23    ADT content from LLVM can be used without linking libSupport. */
24 #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
25 
26 // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
27 // mismatch with LLVM
28 #if defined(_MSC_VER)
29 // Use pragma with MSVC
30 #define LLVM_XSTR(s) LLVM_STR(s)
31 #define LLVM_STR(s) #s
32 #pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
33 #undef LLVM_XSTR
34 #undef LLVM_STR
35 #elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
36 // FIXME: Implement checks without weak.
37 #elif defined(__cplusplus)
38 namespace llvm {
39 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
40 extern int EnableABIBreakingChecks;
41 __attribute__((weak, visibility ("hidden"))) int *VerifyEnableABIBreakingChecks = &EnableABIBreakingChecks;
42 #else
43 extern int DisableABIBreakingChecks;
44 __attribute__((weak, visibility ("hidden"))) int *VerifyDisableABIBreakingChecks = &DisableABIBreakingChecks;
45 #endif
46 }
47 #endif // _MSC_VER
48 
49 #endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
50 
51 #endif
52