This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Silence -Wformat-nonliteral warnings in the Windows support code
ClosedPublic

Authored by mstorsjo on Feb 7 2022, 6:38 AM.

Details

Summary

This brings the mingw build back to zero build warnings as it was
at some earlier time.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Feb 7 2022, 6:38 AM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2022, 6:38 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante accepted this revision as: Mordante.Feb 9 2022, 9:41 AM
Mordante added a subscriber: Mordante.

LGTM!

Would it make sense to turn these warnings into errors when building the library? That way we can never regress.

Would it make sense to turn these warnings into errors when building the library? That way we can never regress.

For building in CI configurations, I think it would make sense to tighten down as many configurations as possible with -Werror, to avoid regressing something that has been clean at some point. For non-CI builds, I don't think we should be building with -Werror by default though.

(The clang-cl builds are incredibly noisy these days, though, due to [[no_unique_address]] not being recognized in MSVC mode - I haven't had time to bring that issue up, and I'm not sure if we want to wrap the attribute in a macro or not.)

Mordante added inline comments.Feb 9 2022, 10:16 AM
libcxx/src/support/win32/locale_win32.cpp
100

I just noticed D119295 so maybe use the macros added there before landing. (Assuming that patch will be accepted.)

mstorsjo added inline comments.Feb 9 2022, 10:24 AM
libcxx/src/support/win32/locale_win32.cpp
100

Yes, maybe - I was hoping to backport this to 14.x to silence the build there too, so then it'd depend on whether that one (which is a bit bigger) is deemed OK to backport.

philnik added inline comments.
libcxx/src/support/win32/locale_win32.cpp
100

I can also hold back on D119295 until this PR is shipped. Just notify me on discord when you have.

mstorsjo updated this revision to Diff 407456.Feb 10 2022, 3:34 AM

Enable LIBCXX_ENABLE_WERROR in the configurations that are fixed by this.

Quuxplusone added a subscriber: Quuxplusone.

FWIW this seems fine to me, but I'll let someone else be the final decider. :)

ldionne accepted this revision.Feb 10 2022, 10:57 AM

LGTM, also looks fine to cherry-pick onto 14.x

This revision is now accepted and ready to land.Feb 10 2022, 10:57 AM
ldionne added inline comments.Feb 10 2022, 11:04 AM
libcxx/utils/ci/run-buildbot
604 ↗(On Diff #407456)

Would you be OK with moving it to the CMake cache instead?

mstorsjo added inline comments.Feb 10 2022, 11:35 AM
libcxx/utils/ci/run-buildbot
604 ↗(On Diff #407456)

I think I’d omit this from this particular patch, and once D119430 lands, I’d make a different patch for enabling LIBCXX_ENABLE_WERROR - which would be opt-out for the few configs that don’t pass in that mode. But let’s move that to a later discussion.

This revision was landed with ongoing or failed builds.Feb 10 2022, 12:45 PM
This revision was automatically updated to reflect the committed changes.