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