From 854367240d62802a547d25fb6027b2c3956e8cbf Mon Sep 17 00:00:00 2001 From: peter klausler Date: Thu, 20 May 2021 13:49:31 -0700 Subject: [PATCH] [flang] Fix broken build of flang with clang A recent commit (e00a170) inadvertently exposed the Reshape runtime function as being extern "C", for which it is not yet ready, leading to a valid warning from clang that we treat as an error. Patch. --- flang/runtime/transformational.cpp | 2 ++ flang/runtime/transformational.h | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/flang/runtime/transformational.cpp b/flang/runtime/transformational.cpp index e7cd089399f5..31262fbaadd3 100644 --- a/flang/runtime/transformational.cpp +++ b/flang/runtime/transformational.cpp @@ -351,6 +351,7 @@ void RTNAME(Pack)(Descriptor &result, const Descriptor &source, } } +} // extern "C" - TODO put Reshape under extern "C" // F2018 16.9.163 OwningPtr RTNAME(Reshape)(const Descriptor &source, const Descriptor &shape, const Descriptor *pad, const Descriptor *order, @@ -464,6 +465,7 @@ OwningPtr RTNAME(Reshape)(const Descriptor &source, return result; } +extern "C" { // TODO - remove when Reshape is under extern "C" // SPREAD void RTNAME(Spread)(Descriptor &result, const Descriptor &source, int dim, diff --git a/flang/runtime/transformational.h b/flang/runtime/transformational.h index 85d2ae5e8e3b..97d5664b16cb 100644 --- a/flang/runtime/transformational.h +++ b/flang/runtime/transformational.h @@ -22,6 +22,13 @@ #include "memory.h" namespace Fortran::runtime { + +// TODO: redo API, put under extern "C" +OwningPtr RTNAME(Reshape)(const Descriptor &source, + const Descriptor &shape, const Descriptor *pad = nullptr, + const Descriptor *order = nullptr, const char *sourceFile = nullptr, + int line = 0); + extern "C" { void RTNAME(Cshift)(Descriptor &result, const Descriptor &source, @@ -41,12 +48,6 @@ void RTNAME(Pack)(Descriptor &result, const Descriptor &source, const Descriptor &mask, const Descriptor *vector = nullptr, const char *sourceFile = nullptr, int line = 0); -// TODO: redo API -OwningPtr RTNAME(Reshape)(const Descriptor &source, - const Descriptor &shape, const Descriptor *pad = nullptr, - const Descriptor *order = nullptr, const char *sourceFile = nullptr, - int line = 0); - void RTNAME(Spread)(Descriptor &result, const Descriptor &source, int dim, std::int64_t ncopies, const char *sourceFile = nullptr, int line = 0);