ExternC.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*===- clang-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. #ifndef LLVM_CLANG_C_EXTERN_C_H
  14. #define LLVM_CLANG_C_EXTERN_C_H
  15. #ifdef __clang__
  16. #define LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN \
  17. _Pragma("clang diagnostic push") \
  18. _Pragma("clang diagnostic error \"-Wstrict-prototypes\"")
  19. #define LLVM_CLANG_C_STRICT_PROTOTYPES_END _Pragma("clang diagnostic pop")
  20. #else
  21. #define LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
  22. #define LLVM_CLANG_C_STRICT_PROTOTYPES_END
  23. #endif
  24. #ifdef __cplusplus
  25. #define LLVM_CLANG_C_EXTERN_C_BEGIN \
  26. extern "C" { \
  27. LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
  28. #define LLVM_CLANG_C_EXTERN_C_END \
  29. LLVM_CLANG_C_STRICT_PROTOTYPES_END \
  30. }
  31. #else
  32. #define LLVM_CLANG_C_EXTERN_C_BEGIN LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
  33. #define LLVM_CLANG_C_EXTERN_C_END LLVM_CLANG_C_STRICT_PROTOTYPES_END
  34. #endif
  35. #endif