This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Mark do_open, do_get and do_close parameters unused when catopen is missing
ClosedPublic

Authored by phosek on Dec 21 2018, 2:07 PM.

Details

Summary

When catopen is missing, do_open, do_get and do_close end up being
no-op, and as such their parameters will be unused which triggers a
warning when building with -Wunused-parameter.

Diff Detail

Repository
rCXX libc++

Event Timeline

phosek created this revision.Dec 21 2018, 2:07 PM
mclow.lists added inline comments.Dec 23 2018, 5:03 PM
libcxx/include/locale
3565

Looking at this, I frowned. It seems like a lot of text just to remove a parameter name.

I went looking in the rest of libc++, and I found places in <unordered_map> where we say ((void)__p) and in <stdexcept> where we say ((void)__msg) rather than conditionally remove the parameter name.

This makes me think that a _LIBCPP_UNUSED_VAR macro might be useful; it would make it clear what we're trying to accomplish: #define _LIBCPP_UNUSED_VAR(x) ((void)(x))

phosek updated this revision to Diff 179605.Dec 27 2018, 10:26 PM
phosek marked an inline comment as done.
phosek updated this revision to Diff 179606.Dec 27 2018, 10:28 PM
mclow.lists accepted this revision.Jan 7 2019, 7:51 AM

I like this much better now; making a note to myself to go back to <unordered_map> and <stdexcept> and use this there.

This revision is now accepted and ready to land.Jan 7 2019, 7:51 AM
This revision was automatically updated to reflect the committed changes.