2021-06-16 19:11:35 +08:00
|
|
|
/*
|
|
|
|
This test makes sure that flang's runtime does not depend on the C++ runtime
|
|
|
|
library. It tries to link this simple file against libFortranRuntime.a with
|
|
|
|
a C compiler.
|
|
|
|
|
|
|
|
REQUIRES: c-compiler
|
|
|
|
|
2021-09-03 17:42:04 +08:00
|
|
|
RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm -o /dev/null
|
2021-06-16 19:11:35 +08:00
|
|
|
*/
|
|
|
|
|
2021-09-02 07:00:53 +08:00
|
|
|
#include "flang/Runtime/entry-names.h"
|
2021-09-03 17:42:04 +08:00
|
|
|
#include <stdint.h>
|
2021-06-16 19:11:35 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
Manually add declarations for the runtime functions that we want to make sure
|
|
|
|
we're testing. We can't include any headers directly since they likely contain
|
|
|
|
C++ code that would explode here.
|
|
|
|
*/
|
2021-09-03 17:42:04 +08:00
|
|
|
struct Descriptor;
|
|
|
|
|
2021-06-16 19:11:35 +08:00
|
|
|
double RTNAME(CpuTime)();
|
|
|
|
|
2021-09-03 17:42:04 +08:00
|
|
|
void RTNAME(ProgramStart)(int, const char *[], const char *[]);
|
|
|
|
int32_t RTNAME(ArgumentCount)();
|
2021-09-28 20:17:34 +08:00
|
|
|
int32_t RTNAME(ArgumentValue)(
|
|
|
|
int32_t, const struct Descriptor *, const struct Descriptor *);
|
2021-09-03 17:42:04 +08:00
|
|
|
int64_t RTNAME(ArgumentLength)(int32_t);
|
|
|
|
|
2021-06-16 19:11:35 +08:00
|
|
|
int main() {
|
|
|
|
double x = RTNAME(CpuTime)();
|
2021-09-03 17:42:04 +08:00
|
|
|
RTNAME(ProgramStart)(0, 0, 0);
|
|
|
|
int32_t c = RTNAME(ArgumentCount)();
|
2021-09-28 20:17:34 +08:00
|
|
|
int32_t v = RTNAME(ArgumentValue)(0, 0, 0);
|
2021-09-03 17:42:04 +08:00
|
|
|
int32_t l = RTNAME(ArgumentLength)(0);
|
|
|
|
return x + c + l;
|
2021-06-16 19:11:35 +08:00
|
|
|
}
|