xref: /llvm-project/flang/include/flang/Runtime/c-or-cpp.h (revision a5a493e1920572ca78b77fcdaef68c26e96d25e7)
1 //===-- include/flang/Runtime/c-or-cpp.h ------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef FORTRAN_RUNTIME_C_OR_CPP_H_
10 #define FORTRAN_RUNTIME_C_OR_CPP_H_
11 
12 #ifdef __cplusplus
13 #define IF_CPLUSPLUS(x) x
14 #define IF_NOT_CPLUSPLUS(x)
15 #define DEFAULT_VALUE(x) = (x)
16 #define RESTRICT __restrict
17 #else
18 #include <stdbool.h>
19 #define IF_CPLUSPLUS(x)
20 #define IF_NOT_CPLUSPLUS(x) x
21 #define DEFAULT_VALUE(x)
22 #define RESTRICT restrict
23 #endif
24 
25 #define FORTRAN_EXTERN_C_BEGIN IF_CPLUSPLUS(extern "C" {)
26 #define FORTRAN_EXTERN_C_END IF_CPLUSPLUS( \
27   })
28 #define NORETURN IF_CPLUSPLUS([[noreturn]])
29 #define NO_ARGUMENTS IF_NOT_CPLUSPLUS(void)
30 
31 #endif // FORTRAN_RUNTIME_C_OR_CPP_H_
32