comparison flang/runtime/main.cpp @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900
parents
children 2e18cbf3894f
comparison
equal deleted inserted replaced
172:9fbae9c8bf63 173:0572611fdcc8
1 //===-- runtime/main.cpp ----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "main.h"
10 #include "environment.h"
11 #include "terminator.h"
12 #include <cfenv>
13 #include <cstdio>
14 #include <cstdlib>
15
16 static void ConfigureFloatingPoint() {
17 #ifdef feclearexcept // a macro in some environments; omit std::
18 feclearexcept(FE_ALL_EXCEPT);
19 #else
20 std::feclearexcept(FE_ALL_EXCEPT);
21 #endif
22 #ifdef fesetround
23 fesetround(FE_TONEAREST);
24 #else
25 std::fesetround(FE_TONEAREST);
26 #endif
27 }
28
29 extern "C" {
30 void RTNAME(ProgramStart)(int argc, const char *argv[], const char *envp[]) {
31 std::atexit(Fortran::runtime::NotifyOtherImagesOfNormalEnd);
32 Fortran::runtime::executionEnvironment.Configure(argc, argv, envp);
33 ConfigureFloatingPoint();
34 // I/O is initialized on demand so that it works for non-Fortran main().
35 }
36 }