From 6ab65bc0c96982c538454ace8f97cc010edc66a0 Mon Sep 17 00:00:00 2001
From: Christian Sigg <csigg@google.com>
Date: Thu, 18 Jul 2019 10:10:36 -0700
Subject: [PATCH] Better workaround for MSVC 14.0 limitation related to
 constexpr array.

PiperOrigin-RevId: 258793545
---
 tensorflow/core/util/memmapped_file_system.cc |  9 ++-------
 tensorflow/core/util/memmapped_file_system.h  | 14 +++-----------
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/tensorflow/core/util/memmapped_file_system.cc b/tensorflow/core/util/memmapped_file_system.cc
index b3ca943c903..a07c1fbb7be 100644
--- a/tensorflow/core/util/memmapped_file_system.cc
+++ b/tensorflow/core/util/memmapped_file_system.cc
@@ -190,13 +190,8 @@ const void* MemmappedFileSystem::GetMemoryWithOffset(uint64 offset) const {
   return reinterpret_cast<const uint8*>(mapped_memory_->data()) + offset;
 }
 
-#if defined(_MSC_VER)
-constexpr char* MemmappedFileSystem::kMemmappedPackagePrefix;
-constexpr char* MemmappedFileSystem::kMemmappedPackageDefaultGraphDef;
-#else
-constexpr char MemmappedFileSystem::kMemmappedPackagePrefix[];
-constexpr char MemmappedFileSystem::kMemmappedPackageDefaultGraphDef[];
-#endif
+constexpr const char MemmappedFileSystem::kMemmappedPackagePrefix[];
+constexpr const char MemmappedFileSystem::kMemmappedPackageDefaultGraphDef[];
 
 Status MemmappedFileSystem::InitializeFromFile(Env* env,
                                                const string& filename) {
diff --git a/tensorflow/core/util/memmapped_file_system.h b/tensorflow/core/util/memmapped_file_system.h
index 958e23d28e5..fea11a8351e 100644
--- a/tensorflow/core/util/memmapped_file_system.h
+++ b/tensorflow/core/util/memmapped_file_system.h
@@ -53,19 +53,11 @@ class MemmappedFileSystem : public FileSystem {
  public:
   // Memmapped regions use this prefix to distinguish from
   // the filesystem.
-#if defined(_MSC_VER)
-  static constexpr char* kMemmappedPackagePrefix =
-#else
-  static constexpr char kMemmappedPackagePrefix[] =
-#endif
+  static constexpr const char kMemmappedPackagePrefix[] =
       "memmapped_package://";
 
-// The default graphdef in the package.
-#if defined(_MSC_VER)
-  static constexpr char* kMemmappedPackageDefaultGraphDef =
-#else
-  static constexpr char kMemmappedPackageDefaultGraphDef[] =
-#endif
+  // The default graphdef in the package.
+  static constexpr const char kMemmappedPackageDefaultGraphDef[] =
       "memmapped_package://.";
 
   MemmappedFileSystem();