Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): fmt 10.0 support #3836

Merged
merged 1 commit into from
May 14, 2023

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented May 13, 2023

fmt 10.0 was recently released, and it breaks a lot for us because they have fully removed legacy support for automatically being able to format anything that has an iostream << operator. This facility was deprecatd in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even that was removed in 10.0.

So this means that we had to write several explicit format handlers for some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor the custom formatters as far as I can tell, so in several cases I also switched those to the std::format/print style.

Fixes #3835

fmt 10.0 was recently released, and it breaks a lot for us because
they have fully removed legacy support for automatically being able to
format anything that has an iostream `<<` operator. This facility was
deprecatd in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM,
but even that was removed in 10.0.

So this means that we had to write several explicit format handlers
for some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.
@@ -26,6 +26,7 @@

// fmt 8.1 stopped automatically enabling formatting of anything that supports
// ostream output. This breaks a lot! Re-enable this old behavior.
// NOTE: fmt 10.0 removed this support entirely.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How old of a version of fmt do we need to support?

Would it be possible to drop the "deprecated ostream" macro here now that you've implemented the missing items?

If I've understood correctly, the formatter functionality is not actually new, its just that we didn't implement the formatters before, right ?

Copy link
Collaborator Author

@lgritz lgritz May 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how far back we "need" to support. I think we can drop some old releases (in master / 2.5-to-be), but I'm not sure how far to push forward.

I'd need to do some archeology on fmt itself to see how far back it fully supports the format extensions (maybe all the way back, I'm just not sure), and also make a judgment call about whether dropping that macro might break anything people depend on -- for example, if people are using any of the utilities in strutil.h such as OIIO::print, format, or debug (which all wrap the fmt functionality), might they be subtly depending on this macro when dealing with types with ostream adapters but no formatter templates?

I want this PR to be fully backportable to solve the immediate problem of fmt 10.0 breaking our build. Then we can separately tackle whether there is simplifications we can make in master but with some acceptable risk of breaking users of format/print if they haven't kept up with writing formatters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. From my reading of the fmt release notes, the ostream_formatter which you are using here was only added in 9.0 (same time they deprecated the "automatic" << handling). So I guess this is the oldest version we can support.

Copy link
Contributor

@fpsunflower fpsunflower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lgritz lgritz merged commit f27a974 into AcademySoftwareFoundation:master May 14, 2023
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request May 14, 2023
fmt 10.0 was recently released, and it breaks a lot for us because they
have fully removed legacy support for automatically being able to format
anything that has an iostream `<<` operator. This facility was deprecatd
in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even
that was removed in 10.0.

So this means that we had to write several explicit format handlers for
some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.

Fixes AcademySoftwareFoundation#3835
@lgritz lgritz deleted the lg-fmt10 branch May 14, 2023 22:10
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request May 14, 2023
fmt 10.0 was recently released, and it breaks a lot for us because they
have fully removed legacy support for automatically being able to format
anything that has an iostream `<<` operator. This facility was deprecatd
in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even
that was removed in 10.0.

So this means that we had to write several explicit format handlers for
some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.

Fixes AcademySoftwareFoundation#3835
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request May 15, 2023
fmt 10.0 was recently released, and it breaks a lot for us because they
have fully removed legacy support for automatically being able to format
anything that has an iostream `<<` operator. This facility was deprecatd
in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even
that was removed in 10.0.

So this means that we had to write several explicit format handlers for
some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.

Fixes AcademySoftwareFoundation#3835
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request May 15, 2023
fmt 10.0 was recently released, and it breaks a lot for us because they
have fully removed legacy support for automatically being able to format
anything that has an iostream `<<` operator. This facility was deprecatd
in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even
that was removed in 10.0.

So this means that we had to write several explicit format handlers for
some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.

Fixes AcademySoftwareFoundation#3835
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request May 15, 2023
fmt 10.0 was recently released, and it breaks a lot for us because they
have fully removed legacy support for automatically being able to format
anything that has an iostream `<<` operator. This facility was deprecatd
in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even
that was removed in 10.0.

So this means that we had to write several explicit format handlers for
some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.

Fixes AcademySoftwareFoundation#3835
birsoyo pushed a commit to birsoyo/oiio that referenced this pull request Jun 8, 2023
fmt 10.0 was recently released, and it breaks a lot for us because they
have fully removed legacy support for automatically being able to format
anything that has an iostream `<<` operator. This facility was deprecatd
in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even
that was removed in 10.0.

So this means that we had to write several explicit format handlers for
some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.

Fixes AcademySoftwareFoundation#3835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Unable to compile with fmt 10.0.0
2 participants