From e4b23fecb0e330b9d376fa3a39593673179c5dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 8 Dec 2023 18:39:27 +0100 Subject: [PATCH] Update comments in relation to implicit conversion from std::filesystem::path to std::string There is actually no bug in MinGW. The different behaviour under Windows is expected, because the implicit conversion there is only to std::wstring. --- src/DynareMain.cc | 6 +++--- src/MacroExpandModFile.cc | 6 +++--- src/macro/Directives.cc | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/DynareMain.cc b/src/DynareMain.cc index 67aefdb9..ea63400a 100644 --- a/src/DynareMain.cc +++ b/src/DynareMain.cc @@ -444,9 +444,9 @@ main(int argc, char** argv) dynareroot = dynareroot.parent_path(); // Construct basename (i.e. remove file extension if there is one) - /* Calling `string()` method on filename because of bug in GCC/MinGW 10.2 - (shipped in Debian “Bullseye” 11), that fails to accept implicit - conversion to string from filename::path. */ + /* Calling string() method on filename.stem(): not necessary on GNU/Linux and macOS because there + is an implicit conversion from filesystem:path to string (i.e. basic_string), but needed + on Windows because the implicit conversion is only to wstring (i.e. basic_string). */ const string basename {filename.stem().string()}; // Forbid some basenames, since they will cause trouble (see preprocessor#62) diff --git a/src/MacroExpandModFile.cc b/src/MacroExpandModFile.cc index 6251ae25..0cebcb2d 100644 --- a/src/MacroExpandModFile.cc +++ b/src/MacroExpandModFile.cc @@ -34,9 +34,9 @@ macroExpandModFile(const filesystem::path& filename, const istream& modfile, boo stringstream macro_output; macro::Environment env = macro::Environment(); macro::Driver m; - /* Calling `string()` method on filename because of bug in GCC/MinGW 10.2 - (shipped in Debian “Bullseye” 11), that fails to accept implicit - conversion to string from filename::path. */ + /* Calling string() method on filename: not necessary on GNU/Linux and macOS because there is an + implicit conversion from filesystem:path to string (i.e. basic_string), but needed on + Windows because the implicit conversion is only to wstring (i.e. basic_string). */ m.parse(filename.string(), modfile, debug, defines, env, paths, macro_output); if (save_macro) { diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc index 6191b1cc..99d1cc32 100644 --- a/src/macro/Directives.cc +++ b/src/macro/Directives.cc @@ -75,10 +75,10 @@ Include::interpret(ostream& output, Environment& env, vector& } } Driver m; - /* Calling `string()` method on filename and filename.stem() because of - bug in GCC/MinGW 10.2 (shipped in Debian “Bullseye” 11), that fails - to accept implicit conversion to string from filename::path. See - https://en.cppreference.com/w/cpp/filesystem/path/native. */ + /* Calling string() method on filename: not necessary on GNU/Linux and macOS because there is + an implicit conversion from from filesystem:path to string (i.e. basic_string), but + needed on Windows because the implicit conversion is only to wstring (i.e. + basic_string). */ m.parse(filename.string(), incfile, false, {}, env, paths, output); } catch (StackTrace& ex)