File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ // ===-- include/flang/Runtime/extensions.h ----------------------*- 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+ // These C-coded entry points with Fortran-mangled names implement legacy
10+ // extensions that will eventually be implemented in Fortran.
11+
12+ #ifndef FORTRAN_RUNTIME_EXTENSIONS_H_
13+ #define FORTRAN_RUNTIME_EXTENSIONS_H_
14+
15+ #define FORTRAN_SUBROUTINE_NAME (name ) name##_
16+
17+ extern " C" {
18+
19+ // CALL FLUSH(n) antedates the Fortran 2003 FLUSH statement.
20+ void FORTRAN_SUBROUTINE_NAME (flush)(const int &unit);
21+
22+ } // extern "C"
23+ #endif // FORTRAN_RUNTIME_EXTENSIONS_H_
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ add_flang_library(FortranRuntime PARTIAL_SOURCES_INTENDED
4242 edit-input .cpp
4343 edit-output .cpp
4444 environment .cpp
45+ extensions.cpp
4546 extrema.cpp
4647 file .cpp
4748 findloc.cpp
Original file line number Diff line number Diff line change 1+ // ===-- runtime/extensions.cpp --------------------------------------------===//
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+ // These C-coded entry points with Fortran-mangled names implement legacy
10+ // extensions that will eventually be implemented in Fortran.
11+
12+ #include " flang/Runtime/extensions.h"
13+ #include " flang/Runtime/io-api.h"
14+
15+ extern " C" {
16+
17+ // SUBROUTINE FLUSH(N)
18+ // FLUSH N
19+ // END
20+ namespace Fortran ::runtime::io {
21+ void FORTRAN_SUBROUTINE_NAME (flush)(const int &unit) {
22+ Cookie cookie{IONAME (BeginFlush)(unit, __FILE__, __LINE__)};
23+ IONAME (EndIoStatement)(cookie);
24+ }
25+ } // namespace Fortran::runtime::io
26+ } // extern "C"
You can’t perform that action at this time.
0 commit comments