[libcxx] r273375 - Make locale constructors tests use count_new.hpp
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 21 21:34:25 PDT 2016
Author: ericwf
Date: Tue Jun 21 23:34:24 2016
New Revision: 273375
URL: http://llvm.org/viewvc/llvm-project?rev=273375&view=rev
Log:
Make locale constructors tests use count_new.hpp
Modified:
libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp
libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp
libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
Modified: libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp?rev=273375&r1=273374&r2=273375&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp Tue Jun 21 23:34:24 2016
@@ -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));
}
More information about the cfe-commits
mailing list