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