Page MenuHomePhabricator

[libcxx] Portability fix: add missing includes.
ClosedPublic

Authored by amakc11 on Jan 9 2019, 10:22 AM.

Details

Reviewers
EricWF
ldionne
Summary

Some tests use strcmp() function, but do not include the string.h header directly. As a result, such tests do not compile under some conformant implementations. This patch adds the mentioned header file to such tests.

Diff Detail

Event Timeline

amakc11 created this revision.Jan 9 2019, 10:22 AM
EricWF added inline comments.Jan 14 2019, 10:06 AM
test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
19

<cstring> instead?

amakc11 added inline comments.Jan 14 2019, 11:00 AM
test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
19

Why? Please, provide reasoning in the context of this very test. My reasoning, for example, is: in standard <string.h> defines strcmp(), <cstring> defines std::strcmp(), this very test uses the first variant of the function call.

ldionne requested changes to this revision.Jan 22 2019, 6:41 AM
ldionne added a reviewer: ldionne.

Please #include <cstring> and switch to std::strcmp instead.

amakc11 updated this revision to Diff 182913.Jan 22 2019, 7:40 AM

For complete consistency with this request, two more tests were patched. Calls to strcmp() replaced with std::strcmp() and <cstring> header added according to the requirement of the standard. The test std/depr/depr.c.headers/string_h.pass.cpp remains untouched since it checks the requirements to <string.h> header.

amakc11 marked an inline comment as done.Jan 22 2019, 7:41 AM
ldionne accepted this revision.Jan 22 2019, 9:44 AM

Thanks!

This revision is now accepted and ready to land.Jan 22 2019, 9:44 AM
ldionne closed this revision.Jan 22 2019, 9:45 AM

Committed as r351847.