diff options
| author | gingerBill <bill@gingerbill.org> | 2021-03-19 15:49:07 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-03-19 15:49:07 +0000 |
| commit | c8a823a387fa8b24ec05b005b1a693f9175323b5 (patch) | |
| tree | 659be72e04b65ac169a03826d52f60ef5f5e291d /src/llvm-c | |
| parent | 178e891c78081a52c6c7a9cd8b66a977e245c387 (diff) | |
Add ExternC.h
Diffstat (limited to 'src/llvm-c')
| -rw-r--r-- | src/llvm-c/ExternC.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/llvm-c/ExternC.h b/src/llvm-c/ExternC.h new file mode 100644 index 000000000..4240f7c31 --- /dev/null +++ b/src/llvm-c/ExternC.h @@ -0,0 +1,39 @@ +/*===- llvm-c/ExternC.h - Wrapper for 'extern "C"' ----------------*- C -*-===*\ +|* *| +|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| +|* Exceptions. *| +|* See https://llvm.org/LICENSE.txt for license information. *| +|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This file defines an 'extern "C"' wrapper *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_C_EXTERN_C_H +#define LLVM_C_EXTERN_C_H + +#ifdef __clang__ +#define LLVM_C_STRICT_PROTOTYPES_BEGIN \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic error \"-Wstrict-prototypes\"") +#define LLVM_C_STRICT_PROTOTYPES_END _Pragma("clang diagnostic pop") +#else +#define LLVM_C_STRICT_PROTOTYPES_BEGIN +#define LLVM_C_STRICT_PROTOTYPES_END +#endif + +#ifdef __cplusplus +#define LLVM_C_EXTERN_C_BEGIN \ + extern "C" { \ + LLVM_C_STRICT_PROTOTYPES_BEGIN +#define LLVM_C_EXTERN_C_END \ + LLVM_C_STRICT_PROTOTYPES_END \ + } +#else +#define LLVM_C_EXTERN_C_BEGIN LLVM_C_STRICT_PROTOTYPES_BEGIN +#define LLVM_C_EXTERN_C_END LLVM_C_STRICT_PROTOTYPES_END +#endif + +#endif |