[libcxx] r351847 - [libcxx] Include <cstring> in tests that use strcmp

Louis Dionne ldionne at apple.com
Tue Jan 22 09:45:00 PST 2019


Author: ldionne
Date: Tue Jan 22 09:45:00 2019
New Revision: 351847

URL: http://llvm.org/viewvc/llvm-project?rev=351847&view=rev
Log:
[libcxx] Include <cstring> in tests that use strcmp

Reviewed as https://reviews.llvm.org/D56503.
Thanks to Andrey Maksimov for the patch.

Modified:
    libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
    libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
    libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp
    libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp

Modified: libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp?rev=351847&r1=351846&r2=351847&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp Tue Jan 22 09:45:00 2019
@@ -14,6 +14,7 @@
 
 #include <strstream>
 #include <cassert>
+#include <cstring>
 #include <string>
 
 int main()
@@ -30,6 +31,6 @@ int main()
     inout >> i >> d >> s;
     assert(i == 123);
     assert(d == 4.5);
-    assert(strcmp(s.c_str(), "dog") == 0);
+    assert(std::strcmp(s.c_str(), "dog") == 0);
     inout.freeze(false);
 }

Modified: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp?rev=351847&r1=351846&r2=351847&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp Tue Jan 22 09:45:00 2019
@@ -15,6 +15,7 @@
 
 #include <streambuf>
 #include <cassert>
+#include <cstring>
 
 struct test
     : public std::basic_streambuf<char>
@@ -36,5 +37,5 @@ int main()
     t.setg(input, input, input+7);
     char output[sizeof(input)] = {0};
     assert(t.sgetn(output, 10) == 7);
-    assert(strcmp(input, output) == 0);
+    assert(std::strcmp(input, output) == 0);
 }

Modified: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp?rev=351847&r1=351846&r2=351847&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp Tue Jan 22 09:45:00 2019
@@ -15,6 +15,7 @@
 
 #include <streambuf>
 #include <cassert>
+#include <cstring>
 
 struct test
     : public std::basic_streambuf<char>
@@ -38,6 +39,6 @@ int main()
         char out[sizeof(in)] = {0};
         t.setp(out, out+sizeof(out));
         assert(t.sputn(in, sizeof(in)) == sizeof(in));
-        assert(strcmp(in, out) == 0);
+        assert(std::strcmp(in, out) == 0);
     }
 }

Modified: libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp?rev=351847&r1=351846&r2=351847&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp Tue Jan 22 09:45:00 2019
@@ -25,8 +25,8 @@ int main()
     const std::type_info& t3 = typeid(short);
     assert(t1 != t3);
     assert(!t1.before(t2));
-    assert(strcmp(t1.name(), t2.name()) == 0);
-    assert(strcmp(t1.name(), t3.name()) != 0);
+    assert(std::strcmp(t1.name(), t2.name()) == 0);
+    assert(std::strcmp(t1.name(), t3.name()) != 0);
   }
   {
     // type_info has a protected constructor taking a string literal. This




More information about the libcxx-commits mailing list