From a5abbae46a3ff5384d3e825b53d435f2629dd688 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 25 May 2020 16:05:52 +0200
Subject: [PATCH] use_dll: remove workaround for char16_t type

Should no longer be needed now that the minimal MATLAB version is R2014a.
---
 src/DynamicModel.cc | 15 +--------------
 src/StaticModel.cc  | 15 +--------------
 2 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 1e326682..ca196bef 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -1215,14 +1215,7 @@ DynamicModel::writeDynamicCFile(const string &basename) const
 
   if (external_functions_table.get_total_number_of_unique_model_block_external_functions())
     // External Matlab function, implies Dynamic function will call mex
-    mDynamicModelFile
-#ifndef __APPLE__
-      << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-#else
-      << "typedef uint_least16_t char16_t;" << endl
-      << "typedef uint_least32_t char32_t;" << endl // uchar.h does not exist on macOS
-#endif
-      << R"(#include "mex.h")" << endl;
+    mDynamicModelFile << R"(#include "mex.h")" << endl;
 
   mDynamicModelFile << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
                     << "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
@@ -1258,12 +1251,6 @@ DynamicModel::writeDynamicCFile(const string &basename) const
                   << " */" << endl
                   << endl
                   << "#include <stdlib.h>" << endl
-#ifndef __APPLE__
-                  << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-#else
-                  << "typedef uint_least16_t char16_t;" << endl
-                  << "typedef uint_least32_t char32_t;" << endl // uchar.h does not exist on macOS
-#endif
                   << R"(#include "mex.h")" << endl
                   << endl
                   << "void dynamic_resid_tt(const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, int it_, double *T);" << endl
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index 2a7958b7..66fb7fc2 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -1603,14 +1603,7 @@ StaticModel::writeStaticCFile(const string &basename) const
 
   if (external_functions_table.get_total_number_of_unique_model_block_external_functions())
     // External Matlab function, implies Static function will call mex
-    output
-#ifndef __APPLE__
-      << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-#else
-      << "typedef uint_least16_t char16_t;" << endl
-      << "typedef uint_least32_t char32_t;" << endl // uchar.h does not exist on macOS
-#endif
-      << R"(#include "mex.h")" << endl;
+    output << R"(#include "mex.h")" << endl;
 
   output << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
          << "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
@@ -1645,12 +1638,6 @@ StaticModel::writeStaticCFile(const string &basename) const
          << " */" << endl
          << endl
          << "#include <stdlib.h>" << endl
-#ifndef __APPLE__
-         << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-#else
-         << "typedef uint_least16_t char16_t;" << endl
-         << "typedef uint_least32_t char32_t;" << endl // uchar.h does not exist on macOS
-#endif
          << R"(#include "mex.h")" << endl
          << endl
          << "void static_resid_tt(const double *y, const double *x, int nb_row_x, const double *params, double *T);" << endl
-- 
GitLab