diff options
| author | Eric Fiselier <eric@efcs.ca> | 2016-06-22 04:34:24 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2016-06-22 04:34:24 +0000 |
| commit | 739cc954710372c7e2bf46175ddbfd179cba1994 (patch) | |
| tree | db85509b1f7ca603b3a4ef5158c616e60cc16621 /libcxx/test | |
| parent | cc4162293f31c413a792488f31c87302cefff8d6 (diff) | |
| download | bcm5719-llvm-739cc954710372c7e2bf46175ddbfd179cba1994.tar.gz bcm5719-llvm-739cc954710372c7e2bf46175ddbfd179cba1994.zip | |
Make locale constructors tests use count_new.hpp
llvm-svn: 273375
Diffstat (limited to 'libcxx/test')
8 files changed, 18 insertions, 129 deletions
diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/assign.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/assign.pass.cpp index 80afe1e46aa..8b31a8f9749 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/assign.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/assign.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -18,21 +17,10 @@ #include <cassert> #include <new> -#include "platform_support.h" // locale name macros - -int new_called = 0; +#include "count_new.hpp" -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} +#include "platform_support.h" // locale name macros -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} void check(const std::locale& loc) { @@ -79,5 +67,5 @@ int main() check(loc); check(loc2); } - assert(new_called == 0); + assert(globalMemCounter.checkOutstandingNewEq(0)); } diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp index b808a7650c4..c7021df8f57 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp @@ -10,7 +10,6 @@ // XFAIL: libcpp-no-exceptions // REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.zh_CN.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -20,21 +19,9 @@ #include <new> #include <cassert> +#include "count_new.hpp" #include "platform_support.h" // locale name macros -int new_called = 0; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} void check(const std::locale& loc) { @@ -101,5 +88,5 @@ int main() } std::locale ok(""); } - assert(new_called == 0); + assert(globalMemCounter.checkOutstandingNewEq(0)); } diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/copy.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/copy.pass.cpp index 0760cc46cdd..9e446e44085 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/copy.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/copy.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // REQUIRES: locale.fr_FR.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -18,22 +17,9 @@ #include <cassert> #include <new> +#include "count_new.hpp" #include "platform_support.h" // locale name macros -int new_called = 0; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} - void check(const std::locale& loc) { assert(std::has_facet<std::collate<char> >(loc)); @@ -78,5 +64,5 @@ int main() check(loc); check(loc2); } - assert(new_called == 0); + assert(globalMemCounter.checkOutstandingNewEq(0)); } diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp index 2a9e20fcf98..eb381f9a580 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp @@ -9,7 +9,6 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -19,22 +18,9 @@ #include <new> #include <cassert> +#include "count_new.hpp" #include "platform_support.h" // locale name macros -int new_called = 0; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} - void check(const std::locale& loc) { assert(std::has_facet<std::collate<char> >(loc)); @@ -78,5 +64,5 @@ int main() std::locale loc2(loc, LOCALE_en_US_UTF_8, std::locale::monetary); check(loc2); } - assert(new_called == 0); + assert(globalMemCounter.checkOutstandingNewEq(0)); } diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp index fb6e39e5742..1144931e3d2 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -18,21 +17,9 @@ #include <new> #include <cassert> +#include "count_new.hpp" #include "platform_support.h" // locale name macros -int new_called = 0; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} void check(const std::locale& loc) { @@ -81,7 +68,6 @@ std::locale::id my_facet::id; int main() { -{ { std::locale loc(LOCALE_ru_RU_UTF_8); check(loc); @@ -91,9 +77,7 @@ int main() const my_facet& f = std::use_facet<my_facet>(loc2); assert(f.test() == 5); } - assert(new_called == 0); -} -{ + assert(globalMemCounter.checkOutstandingNewEq(0)); { std::locale loc; check(loc); @@ -101,6 +85,5 @@ int main() check(loc2); assert(loc == loc2); } - assert(new_called == 0); -} + assert(globalMemCounter.checkOutstandingNewEq(0)); } diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp index fa87eb20e9a..f1afff66580 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp @@ -9,7 +9,6 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -19,22 +18,9 @@ #include <new> #include <cassert> +#include "count_new.hpp" #include "platform_support.h" // locale name macros -int new_called = 0; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} - void check(const std::locale& loc) { assert(std::has_facet<std::collate<char> >(loc)); @@ -78,5 +64,5 @@ int main() std::locale loc2(loc, std::locale(LOCALE_en_US_UTF_8), std::locale::monetary); check(loc2); } - assert(new_called == 0); + assert(globalMemCounter.checkOutstandingNewEq(0)); } diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp index 4454e1eabd3..eb63cd03b66 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp @@ -9,7 +9,6 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -19,21 +18,9 @@ #include <new> #include <cassert> +#include "count_new.hpp" #include "platform_support.h" // locale name macros -int new_called = 0; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} void check(const std::locale& loc) { @@ -78,5 +65,5 @@ int main() std::locale loc2(loc, std::string(LOCALE_en_US_UTF_8), std::locale::monetary); check(loc2); } - assert(new_called == 0); + assert(globalMemCounter.checkOutstandingNewEq(0)); } diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/string.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/string.pass.cpp index c9f944196e7..6fc0808b272 100644 --- a/libcxx/test/std/localization/locales/locale/locale.cons/string.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.cons/string.pass.cpp @@ -9,7 +9,6 @@ // REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.zh_CN.UTF-8 -// UNSUPPORTED: sanitizer-new-delete // <locale> @@ -19,22 +18,9 @@ #include <new> #include <cassert> +#include "count_new.hpp" #include "platform_support.h" // locale name macros -int new_called = 0; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - ++new_called; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - --new_called; - std::free(p); -} - void check(const std::locale& loc) { assert(std::has_facet<std::collate<char> >(loc)); @@ -83,5 +69,5 @@ int main() assert(!(loc == loc3)); assert(loc != loc3); } - assert(new_called == 0); + assert(globalMemCounter.checkOutstandingNewEq(0)); } |

