ExternC.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. /*===- clang-c/ExternC.h - Wrapper for 'extern "C"' ---------------*- C -*-===*\
  7. |* *|
  8. |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
  9. |* Exceptions. *|
  10. |* See https://llvm.org/LICENSE.txt for license information. *|
  11. |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
  12. |* *|
  13. |*===----------------------------------------------------------------------===*|
  14. |* *|
  15. |* This file defines an 'extern "C"' wrapper. *|
  16. |* *|
  17. \*===----------------------------------------------------------------------===*/
  18. #ifndef LLVM_CLANG_C_EXTERN_C_H
  19. #define LLVM_CLANG_C_EXTERN_C_H
  20. #ifdef __clang__
  21. #define LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN \
  22. _Pragma("clang diagnostic push") \
  23. _Pragma("clang diagnostic error \"-Wstrict-prototypes\"")
  24. #define LLVM_CLANG_C_STRICT_PROTOTYPES_END _Pragma("clang diagnostic pop")
  25. #else
  26. #define LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
  27. #define LLVM_CLANG_C_STRICT_PROTOTYPES_END
  28. #endif
  29. #ifdef __cplusplus
  30. #define LLVM_CLANG_C_EXTERN_C_BEGIN \
  31. extern "C" { \
  32. LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
  33. #define LLVM_CLANG_C_EXTERN_C_END \
  34. LLVM_CLANG_C_STRICT_PROTOTYPES_END \
  35. }
  36. #else
  37. #define LLVM_CLANG_C_EXTERN_C_BEGIN LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
  38. #define LLVM_CLANG_C_EXTERN_C_END LLVM_CLANG_C_STRICT_PROTOTYPES_END
  39. #endif
  40. #endif
  41. #ifdef __GNUC__
  42. #pragma GCC diagnostic pop
  43. #endif