[PATCH] D29197: Avoid implementation defined behavior in a test.
Dan Albert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 2 11:55:41 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293926: Avoid implementation defined behavior in a test. (authored by danalbert).
Changed prior to commit:
https://reviews.llvm.org/D29197?vs=85961&id=86866#toc
Repository:
rL LLVM
https://reviews.llvm.org/D29197
Files:
libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
Index: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
===================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
@@ -38,6 +38,12 @@
char str[50];
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "0x0" || ex == "(nil)");
+ char expected_str[32] = {};
+ // num_put::put uses %p for pointer types, but the exact format of %p is
+ // implementation defined behavior for the C library. Compare output to
+ // snprintf for portability.
+ int rc = snprintf(expected_str, sizeof(expected_str), "%p", v);
+ assert(rc > 0);
+ assert(ex == expected_str);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29197.86866.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170202/a9c46f42/attachment.bin>
More information about the cfe-commits
mailing list