1 /*
2 This test makes sure that flang's runtime does not depend on the C++ runtime
3 library. It tries to link this simple file against libFortranRuntime.a with
4 a C compiler.
5 
6 REQUIRES: c-compiler
7 
8 RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm -o /dev/null
9 */
10 
11 #include "flang/Runtime/entry-names.h"
12 #include <stdint.h>
13 
14 /*
15 Manually add declarations for the runtime functions that we want to make sure
16 we're testing. We can't include any headers directly since they likely contain
17 C++ code that would explode here.
18 */
19 struct Descriptor;
20 
21 double RTNAME(CpuTime)();
22 
23 void RTNAME(ProgramStart)(int, const char *[], const char *[]);
24 int32_t RTNAME(ArgumentCount)();
25 int32_t RTNAME(ArgumentValue)(
26     int32_t, const struct Descriptor *, const struct Descriptor *);
27 int64_t RTNAME(ArgumentLength)(int32_t);
28 
main()29 int main() {
30   double x = RTNAME(CpuTime)();
31   RTNAME(ProgramStart)(0, 0, 0);
32   int32_t c = RTNAME(ArgumentCount)();
33   int32_t v = RTNAME(ArgumentValue)(0, 0, 0);
34   int32_t l = RTNAME(ArgumentLength)(0);
35   return x + c + l;
36 }
37