gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Code to replace path separators on DOS-based filesystems is invalid

Open CohenArthur opened this issue 1 year ago • 2 comments

  // On windows, the path might mix '/' and '\' separators. Replace the
  // UNIX-like separators by MSDOS separators to make sure the path will resolve
  // properly.
  //
  // Source: rustc compiler
  // (https://github.com/rust-lang/rust/blob/9863bf51a52b8e61bcad312f81b5193d53099f9f/compiler/rustc_expand/src/module.rs#L174)
#if defined(HAVE_DOS_BASED_FILE_SYSTEM)
  path.replace ('/', '\\');
#endif /* HAVE_DOS_BASED_FILE_SYSTEM */

this code is invalid, and throws an error about a lack of matching function. https://en.cppreference.com/w/cpp/string/basic_string/replace shows that indeed this is not a correct usage of the function, and that we should change it.

CohenArthur avatar Apr 24 '24 15:04 CohenArthur

This is also mentioned in #2843 and can be replaced with a call to std::replace

CohenArthur avatar Apr 24 '24 15:04 CohenArthur

Assigning this to myself because this has been fixed by a patch from a GCC contributor, which I need to tweak and push here as a PR

CohenArthur avatar May 06 '24 12:05 CohenArthur

@CohenArthur any change on this ? We should have merged the patch by now

P-E-P avatar Sep 11 '24 13:09 P-E-P

we should have but I forgot :grimacing: I'll try and take care of it

CohenArthur avatar Sep 16 '24 03:09 CohenArthur

Fixed in #3164

P-E-P avatar Sep 30 '24 14:09 P-E-P