Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Differential D105910 Diff 358331 libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// z/OS doesn't currently have runtime linking. This prevents calls to new and | |||||
// delete in the standard library (like the one in ctype<char>::~ctype) from | |||||
// invoking user-defined versions of those operators (like the ones in | |||||
// count_new.h). Thus, globalMemCounter doesn't see the delete[] it's expecting. | |||||
// UNSUPPORTED: target={{.+}}-zos{{.*}} | |||||
// <locale> | // <locale> | ||||
// template <> class ctype<char> | // template <> class ctype<char> | ||||
// ~ctype(); | // ~ctype(); | ||||
#include <locale> | #include <locale> | ||||
#include <cassert> | #include <cassert> | ||||
Show All 17 Lines | int main(int, char**) | ||||
assert(globalMemCounter.checkDeleteArrayCalledEq(0)); | assert(globalMemCounter.checkDeleteArrayCalledEq(0)); | ||||
{ | { | ||||
std::locale l(std::locale::classic(), | std::locale l(std::locale::classic(), | ||||
new std::ctype<char>(new std::ctype<char>::mask[256], true)); | new std::ctype<char>(new std::ctype<char>::mask[256], true)); | ||||
assert(globalMemCounter.checkDeleteArrayCalledEq(0)); | assert(globalMemCounter.checkDeleteArrayCalledEq(0)); | ||||
} | } | ||||
// On windows, the operator new from count_new.h can't override the default | // On windows, the operator new from count_new.h can't override the default | ||||
// operator for calls within the libc++ DLL. | // operator for calls within the libc++ DLL. | ||||
TEST_NOT_WIN32_DLL(assert(globalMemCounter.checkDeleteArrayCalledEq(1))); | TEST_NOT_WIN32_DLL(assert(globalMemCounter.checkDeleteArrayCalledEq(1))); | ||||
mstorsjo: Here's an example on how this aspect only is waived in the Windows/DLL configuration. | |||||
QuuxplusoneUnsubmitted Not Done ReplyInline ActionsPerhaps the macro's sense could be flipped, something like ASSERT_VIA_OVERRIDDEN_NEW(globalMemCounter.checkDeleteArrayCalledEq(1)); similar to our existing ASSERT_NOEXCEPT and ASSERT_SAME_TYPE testing macros. Then, on platforms that support overridden new and delete operators, that macro would expand to assert; and on other platforms (Win32, z/OS) it would expand to a no-op. Quuxplusone: Perhaps the macro's sense could be flipped, something like
```
ASSERT_VIA_OVERRIDDEN_NEW… | |||||
return 0; | return 0; | ||||
} | } |
Here's an example on how this aspect only is waived in the Windows/DLL configuration.