[flang-commits] [flang] 8543672 - [flang] Fix broken build of flang with clang

peter klausler via flang-commits flang-commits at lists.llvm.org
Thu May 20 13:55:29 PDT 2021


Author: peter klausler
Date: 2021-05-20T13:49:31-07:00
New Revision: 854367240d62802a547d25fb6027b2c3956e8cbf

URL: https://github.com/llvm/llvm-project/commit/854367240d62802a547d25fb6027b2c3956e8cbf
DIFF: https://github.com/llvm/llvm-project/commit/854367240d62802a547d25fb6027b2c3956e8cbf.diff

LOG: [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.

Added: 
    

Modified: 
    flang/runtime/transformational.cpp
    flang/runtime/transformational.h

Removed: 
    


################################################################################
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<Descriptor> RTNAME(Reshape)(const Descriptor &source,
     const Descriptor &shape, const Descriptor *pad, const Descriptor *order,
@@ -464,6 +465,7 @@ OwningPtr<Descriptor> 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<Descriptor> 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<Descriptor> 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);
 


        


More information about the flang-commits mailing list