[flang-commits] [PATCH] D83397: [flang] Replace uses of _Complex with std::complex

Eric Christopher via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Jul 8 07:20:37 PDT 2020


echristo created this revision.
echristo added a reviewer: DavidTruby.
echristo added a project: Flang.
Herald added subscribers: llvm-commits, mcrosier.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.

Fixing warning: '_Complex' is a C99 extension [-Wc99-extensions].

The functions are currently unused so no real testing has happened past build time, however, complex is strictly compatible with _Complex in the C++ standard and can be reinterpret casted in uses.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83397

Files:
  flang/lib/Lower/RTBuilder.h


Index: flang/lib/Lower/RTBuilder.h
===================================================================
--- flang/lib/Lower/RTBuilder.h
+++ flang/lib/Lower/RTBuilder.h
@@ -22,6 +22,7 @@
 #include "mlir/IR/MLIRContext.h"
 #include "mlir/IR/StandardTypes.h"
 #include "llvm/ADT/SmallVector.h"
+#include <complex>
 #include <functional>
 
 // List the runtime headers we want to be able to dissect
@@ -158,13 +159,13 @@
 }
 
 template <>
-constexpr TypeBuilderFunc getModel<float _Complex>() {
+constexpr TypeBuilderFunc getModel<std::complex<float>>() {
   return [](mlir::MLIRContext *context) -> mlir::Type {
     return fir::CplxType::get(context, sizeof(float));
   };
 }
 template <>
-constexpr TypeBuilderFunc getModel<double _Complex>() {
+constexpr TypeBuilderFunc getModel<std::complex<double>>() {
   return [](mlir::MLIRContext *context) -> mlir::Type {
     return fir::CplxType::get(context, sizeof(double));
   };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83397.276424.patch
Type: text/x-patch
Size: 925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200708/b24a2417/attachment-0001.bin>


More information about the flang-commits mailing list