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#define LLVM_ENABLE_ABI_BREAKING_CHECKS 1
17
18/* Define to disable the link-time checking of mismatch for
19   LLVM_ENABLE_ABI_BREAKING_CHECKS */
20#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 1
21#if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
22
23// ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
24// mismatch with LLVM
25#if defined(_MSC_VER)
26// Use pragma with MSVC
27#define LLVM_XSTR(s) LLVM_STR(s)
28#define LLVM_STR(s) #s
29#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
30#undef LLVM_XSTR
31#undef LLVM_STR
32#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
33// FIXME: Implement checks without weak.
34#elif defined(__cplusplus)
35namespace llvm {
36#if LLVM_ENABLE_ABI_BREAKING_CHECKS
37extern int EnableABIBreakingChecks;
38__attribute__((weak, visibility ("hidden"))) int *VerifyEnableABIBreakingChecks = &EnableABIBreakingChecks;
39#else
40extern int DisableABIBreakingChecks;
41__attribute__((weak, visibility ("hidden"))) int *VerifyDisableABIBreakingChecks = &DisableABIBreakingChecks;
42#endif
43}
44#endif // _MSC_VER
45
46#endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
47
48#endif
49