spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Update fmt lib to v9.0.0

Open YuZhangGHub opened this issue 3 years ago • 3 comments

Hi fmt v9.0.0 has a big update and better implementation on snprintf and output. Please update it. Thanks.

YuZhangGHub avatar Aug 23 '22 03:08 YuZhangGHub

Note that fmt v9.0.0 deprecated automatic ostream formatting that may need additional consideration by spdlog (I'm currently evaluating spdlog v1.10.0 with fmt v9.1.0):

Disabled automatic std::ostream insertion operator (operator<<) discovery when fmt/ostream.h is included to prevent ODR violations. You can get the old behavior by defining FMT_DEPRECATED_OSTREAM but this will be removed in the next major release. Use fmt::streamed or fmt::ostream_formatter to enable formatting via std::ostream instead.

https://github.com/fmtlib/fmt/releases/tag/9.0.0

xbreak avatar Sep 21 '22 08:09 xbreak

Thanks for the heads up. what additional consideration is needed?

gabime avatar Sep 21 '22 09:09 gabime

I'm not sure if you or your users would consider it a breaking change in spdlog if automatic ostream formatting disappears for example.

xbreak avatar Sep 21 '22 11:09 xbreak

An argument for the update is that fmt v9.x fixes a deprecation warning on newer Clang version with C++20 (https://github.com/fmtlib/fmt/issues/2408).

offa avatar Sep 29 '22 17:09 offa

I'm not sure if you or your users would consider it a breaking change in spdlog if automatic ostream formatting disappears for example.

The old behaviour could be activated with FMT_DEPRECATED_OSTREAM definition. It would be removed in future major fmtlib releases (as stated in release notes for 9.0.0). Yet it still could be used as a workaround to introduce 9.x.x support without breaking backward compatibility.

SX91 avatar Oct 27 '22 16:10 SX91

Thanks for the info @SX91 ! For the upcoming spdlog release I will have to consider this (whether to define FMT_DEPRECATED_OSTREAM or not).

gabime avatar Oct 27 '22 17:10 gabime

Hello, @gabime ! Thanks for your reply.

I think, leaving this problem to end user would break existing code, which relies on auto ostream-based formatting. Sure, user could add this definition manually on cmake level, but it would be nice to have an option to disable deprecated behaviour (enabled by default) via cmake option or tweakme.h. At least until next major fmtlib upgrade.

If there's no other backwards incompatible changes in spdlog that is.

SX91 avatar Oct 28 '22 14:10 SX91

Updated to fmt version 9.1.0. Preserved for this version the deprecated ostream formatting by defining FMT_DEPRECATED_OSTREAM

gabime avatar Oct 31 '22 23:10 gabime