vcpkg/ports/fmt/fix-visibility.patch
Weihang Ding c764ada376
[fmt] Fix visibility (#35793)
- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md)
- [x] SHA512s are updated for each updated download
- [x] The "supports" clause reflects platforms that may be fixed by this
new version
- [x] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [x] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.

```
ld: warning: direct access in function 'fmt::v10::detail::format_error_code(fmt::v10::detail::buffer<char>&, int, fmt::v10::basic_string_view<char>)' from file '/usr/local/vcpkg/installed/x64-osx/lib/libfmt.a(format.cc.o)' to global weak symbol 'decltype(fp.begin()) fmt::v10::detail::parse_format_specs<int, fmt::v10::detail::compile_parse_context<char> >(fmt::v10::detail::compile_parse_context<char>&)' from file '/usr/local/vcpkg/installed/x64-osx/lib/libspdlog.a(spdlog.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
```

When link with `spdlog`, it shows this warning.

This problem was once reported in #29280 by @marcovc

And this pr fix it.
2024-02-27 01:02:58 -08:00

13 lines
576 B
Diff

diff --git a/include/fmt/core.h b/include/fmt/core.h
index b51c1406..bb139509 100644
--- a/include/fmt/core.h
+++ b/include/fmt/core.h
@@ -2306,6 +2306,7 @@ enum class state { start, align, sign, hash, zero, width, precision, locale };
// Parses standard format specifiers.
template <typename Char>
+FMT_VISIBILITY("hidden") // Suppress an ld warning on macOS (#3769).
FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(
const Char* begin, const Char* end, dynamic_format_specs<Char>& specs,
basic_format_parse_context<Char>& ctx, type arg_type) -> const Char* {