From 4790fa00d8ad4d931442bcdb44f1cccf2292e10f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 8 Dec 2023 18:20:52 +0100
Subject: [PATCH] Remove workaround for bug in MinGW compiler
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It would mishandle trailing slashes or backslashes in std::filesystem::path, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88881

The bug is now fixed in the version of MinGW in Debian “bookworm” 12.

Ref. Madysson/estimation-codes#11
---
 src/macro/Directives.cc | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc
index a1bd74ad..6191b1cc 100644
--- a/src/macro/Directives.cc
+++ b/src/macro/Directives.cc
@@ -103,20 +103,7 @@ IncludePath::interpret([[maybe_unused]] ostream& output, Environment& env,
       StringPtr msp = dynamic_pointer_cast<String>(expr->eval(env));
       if (!msp)
         throw StackTrace("File name does not evaluate to a string");
-#ifdef _WIN32
-      /* Trim trailing slashes and backslashes in the path. This is a
-         workaround for a GCC/MinGW bug present in version 10.2
-         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88881, that affects
-         gcc-mingw-w64 in Debian “Bullseye” 11. It is fixed in GCC 10.3, and
-         thus should be fixed in Debian “Bookworm” 12.
-         See Madysson/estimation-codes#11. */
-      string ipstr = static_cast<string>(*msp);
-      while (ipstr.size() > 1 && (ipstr.back() == '/' || ipstr.back() == '\\'))
-        ipstr.pop_back();
-      path ip {ipstr};
-#else
       path ip = static_cast<string>(*msp);
-#endif
       if (!is_directory(ip))
         throw StackTrace(ip.string() + " does not evaluate to a valid directory");
       if (!exists(ip))
-- 
GitLab