Skip to content

Commit

Permalink
fs: suppress u8path deprecated-declaration warnings with libc++
Browse files Browse the repository at this point in the history
When building in c++20 mode using libc++, the following warning is
emitted:
```bash
./fs.h:72:29: warning: 'u8path<std::string>' is deprecated [-Wdeprecated-declarations]
    return std::filesystem::u8path(utf8_str);
                            ^
/usr/lib/llvm-14/bin/../include/c++/v1/__filesystem/u8path.h:72:27: note: 'u8path<std::string>' has been explicitly marked deprecated here
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
                          ^
/usr/lib/llvm-14/bin/../include/c++/v1/__config:1042:43: note: expanded from macro '_LIBCPP_DEPRECATED_WITH_CHAR8_T'
                                          ^
/usr/lib/llvm-14/bin/../include/c++/v1/__config:1007:48: note: expanded from macro '_LIBCPP_DEPRECATED'
                                               ^
1 warning generated.
```

as u8path<std::string> is deprecated starting with c++20.

Fixes: bitcoin#24682.
  • Loading branch information
fanquake committed Aug 8, 2022
1 parent 9ff6adc commit b7ca628
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ class path : public std::filesystem::path
path filename() const { return std::filesystem::path::filename(); }
};

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static inline path u8path(const std::string& utf8_str)
{
return std::filesystem::u8path(utf8_str);
}
#pragma GCC diagnostic pop

// Disallow implicit std::string conversion for absolute to avoid
// locale-dependent encoding on windows.
Expand Down

0 comments on commit b7ca628

Please sign in to comment.