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: %if system-aix %{ export OBJECT_MODE=64 %}
9 RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm \
10 RUN: %if system-aix %{-lpthread %}
11 RUN: rm a.out
12 */
13
14 #include "flang/Runtime/entry-names.h"
15 #include <stdint.h>
16
17 /*
18 Manually add declarations for the runtime functions that we want to make sure
19 we're testing. We can't include any headers directly since they likely contain
20 C++ code that would explode here.
21 */
22 struct EnvironmentDefaultList;
23 struct Descriptor;
24
25 double RTNAME(CpuTime)();
26
27 void RTNAME(ProgramStart)(
28 int, const char *[], const char *[], const struct EnvironmentDefaultList *);
29 int32_t RTNAME(ArgumentCount)();
30 int32_t RTNAME(GetCommandArgument)(int32_t, const struct Descriptor *,
31 const struct Descriptor *, const struct Descriptor *);
32 int32_t RTNAME(GetEnvVariable)();
33 int64_t RTNAME(SystemClockCount)(int kind);
34
main()35 int main() {
36 double x = RTNAME(CpuTime)();
37 RTNAME(ProgramStart)(0, 0, 0, 0);
38 int32_t c = RTNAME(ArgumentCount)();
39 int32_t v = RTNAME(GetCommandArgument)(0, 0, 0, 0);
40 int32_t e = RTNAME(GetEnvVariable)("FOO", 0, 0);
41 int64_t t = RTNAME(SystemClockCount)(8);
42 return x + c + v + e;
43 }
44