Home | History | Annotate | Line # | Download | only in llvm-c
      1 /*===- llvm-c/ExternC.h - Wrapper for 'extern "C"' ----------------*- C -*-===*\
      2 |*                                                                            *|
      3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
      4 |* Exceptions.                                                                *|
      5 |* See https://llvm.org/LICENSE.txt for license information.                  *|
      6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
      7 |*                                                                            *|
      8 |*===----------------------------------------------------------------------===*|
      9 |*                                                                            *|
     10 |* This file defines an 'extern "C"' wrapper                                  *|
     11 |*                                                                            *|
     12 \*===----------------------------------------------------------------------===*/
     13 
     14 #ifndef LLVM_C_EXTERNC_H
     15 #define LLVM_C_EXTERNC_H
     16 
     17 #ifdef __clang__
     18 #define LLVM_C_STRICT_PROTOTYPES_BEGIN                                         \
     19   _Pragma("clang diagnostic push")                                             \
     20       _Pragma("clang diagnostic error \"-Wstrict-prototypes\"")
     21 #define LLVM_C_STRICT_PROTOTYPES_END _Pragma("clang diagnostic pop")
     22 #else
     23 #define LLVM_C_STRICT_PROTOTYPES_BEGIN
     24 #define LLVM_C_STRICT_PROTOTYPES_END
     25 #endif
     26 
     27 #ifdef __cplusplus
     28 #define LLVM_C_EXTERN_C_BEGIN                                                  \
     29   extern "C" {                                                                 \
     30   LLVM_C_STRICT_PROTOTYPES_BEGIN
     31 #define LLVM_C_EXTERN_C_END                                                    \
     32   LLVM_C_STRICT_PROTOTYPES_END                                                 \
     33   }
     34 #else
     35 #define LLVM_C_EXTERN_C_BEGIN LLVM_C_STRICT_PROTOTYPES_BEGIN
     36 #define LLVM_C_EXTERN_C_END LLVM_C_STRICT_PROTOTYPES_END
     37 #endif
     38 
     39 #endif
     40