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

source code of flang/test/Runtime/no-cpp-dep.c