Skip to content

Commit 42a1d88

Browse files
committed
ICU-23190 Delete obsolete U_HAVE_PLACEMENT_NEW.
1 parent b86b7a5 commit 42a1d88

File tree

8 files changed

+2
-70
lines changed

8 files changed

+2
-70
lines changed

icu4c/source/common/cmemory.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,7 @@ class MaybeStackArray {
334334
// No heap allocation. Use only on the stack.
335335
static void* U_EXPORT2 operator new(size_t) noexcept = delete;
336336
static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
337-
#if U_HAVE_PLACEMENT_NEW
338337
static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
339-
#endif
340338

341339
/**
342340
* Default constructor initializes with internal T[stackCapacity] buffer.
@@ -570,9 +568,7 @@ class MaybeStackHeaderAndArray {
570568
// No heap allocation. Use only on the stack.
571569
static void* U_EXPORT2 operator new(size_t) noexcept = delete;
572570
static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
573-
#if U_HAVE_PLACEMENT_NEW
574571
static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
575-
#endif
576572

577573
/**
578574
* Default constructor initializes with internal H+T[stackCapacity] buffer.

icu4c/source/common/unicode/localpointer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ class LocalPointerBase {
7070
// No heap allocation. Use only on the stack.
7171
static void* U_EXPORT2 operator new(size_t) = delete;
7272
static void* U_EXPORT2 operator new[](size_t) = delete;
73-
#if U_HAVE_PLACEMENT_NEW
7473
static void* U_EXPORT2 operator new(size_t, void*) = delete;
75-
#endif
7674

7775
/**
7876
* Constructor takes ownership.

icu4c/source/common/unicode/platform.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,6 @@
368368
# define U_IS_BIG_ENDIAN 0
369369
#endif
370370

371-
/**
372-
* \def U_HAVE_PLACEMENT_NEW
373-
* Determines whether to override placement new and delete for STL.
374-
* @stable ICU 2.6
375-
*/
376-
#ifdef U_HAVE_PLACEMENT_NEW
377-
/* Use the predefined value. */
378-
#elif defined(__BORLANDC__)
379-
# define U_HAVE_PLACEMENT_NEW 0
380-
#else
381-
# define U_HAVE_PLACEMENT_NEW 1
382-
#endif
383-
384371
/**
385372
* \def U_HAVE_DEBUG_LOCATION_NEW
386373
* Define this to define the MFC debug version of the operator new.

icu4c/source/common/unicode/uobject.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ class U_COMMON_API UMemory {
157157
*/
158158
static void U_EXPORT2 operator delete[](void *p) noexcept;
159159

160-
#if U_HAVE_PLACEMENT_NEW
161160
/**
162161
* Override for ICU4C C++ memory management for STL.
163162
* See new().
@@ -171,7 +170,7 @@ class U_COMMON_API UMemory {
171170
* @stable ICU 2.6
172171
*/
173172
static inline void U_EXPORT2 operator delete(void *, void *) noexcept {}
174-
#endif /* U_HAVE_PLACEMENT_NEW */
173+
175174
#if U_HAVE_DEBUG_LOCATION_NEW
176175
/**
177176
* This method overrides the MFC debug version of the operator new

icu4c/source/common/uresimp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ class U_COMMON_API StackUResourceBundle {
120120
// No heap allocation. Use only on the stack.
121121
static void* U_EXPORT2 operator new(size_t) noexcept = delete;
122122
static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
123-
#if U_HAVE_PLACEMENT_NEW
124123
static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
125-
#endif
126124

127125
StackUResourceBundle();
128126
~StackUResourceBundle();

icu4c/source/configure.ac

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -696,50 +696,6 @@ fi
696696
AC_SUBST(U_HAVE_NL_LANGINFO_CODESET)
697697
AC_SUBST(U_NL_LANGINFO_CODESET)
698698

699-
AC_LANG(C++)
700-
AC_MSG_CHECKING([for properly overriding new and delete])
701-
U_OVERRIDE_CXX_ALLOCATION=0
702-
U_HAVE_PLACEMENT_NEW=0
703-
AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok,
704-
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
705-
class UMemory {
706-
public:
707-
void *operator new(size_t size) {return malloc(size);}
708-
void *operator new[](size_t size) {return malloc(size);}
709-
void operator delete(void *p) {free(p);}
710-
void operator delete[](void *p) {free(p);}
711-
};
712-
]], [])],[ac_cv_override_cxx_allocation_ok=yes],[ac_cv_override_cxx_allocation_ok=no])] )
713-
AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok)
714-
if test $ac_cv_override_cxx_allocation_ok = yes
715-
then
716-
U_OVERRIDE_CXX_ALLOCATION=1
717-
AC_MSG_CHECKING([for placement new and delete])
718-
AC_CACHE_VAL(ac_cv_override_placement_new_ok,
719-
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
720-
class UMemory {
721-
public:
722-
void *operator new(size_t size) {return malloc(size);}
723-
void *operator new[](size_t size) {return malloc(size);}
724-
void operator delete(void *p) {free(p);}
725-
void operator delete[](void *p) {free(p);}
726-
void * operator new(size_t, void *ptr) { return ptr; }
727-
void operator delete(void *, void *) {}
728-
};
729-
]], [])],[ac_cv_override_placement_new_ok=yes],[ac_cv_override_placement_new_ok=no])] )
730-
AC_MSG_RESULT($ac_cv_override_placement_new_ok)
731-
if test $ac_cv_override_placement_new_ok = yes
732-
then
733-
U_HAVE_PLACEMENT_NEW=1
734-
else
735-
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_PLACEMENT_NEW=0"
736-
fi
737-
else
738-
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_OVERRIDE_CXX_ALLOCATION=0"
739-
fi
740-
AC_SUBST(U_OVERRIDE_CXX_ALLOCATION)
741-
AC_SUBST(U_HAVE_PLACEMENT_NEW)
742-
743699
AC_LANG(C)
744700
AC_CHECK_FUNC(popen)
745701
if test x$ac_cv_func_popen = xyes

icu4c/source/i18n/fphdlimp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ class U_I18N_API FieldPositionIteratorHandler : public FieldPositionHandler {
7676
// This attempts to encourage that by blocking heap allocation.
7777
static void* U_EXPORT2 operator new(size_t) noexcept = delete;
7878
static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
79-
#if U_HAVE_PLACEMENT_NEW
8079
static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
81-
#endif
8280

8381
public:
8482
FieldPositionIteratorHandler(FieldPositionIterator* posIter, UErrorCode& status);

icu4c/source/test/intltest/uobjtest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void UObjectTest::testIDs()
507507

508508
void UObjectTest::testUMemory() {
509509
// additional tests for code coverage
510-
#if U_OVERRIDE_CXX_ALLOCATION && U_HAVE_PLACEMENT_NEW
510+
#if U_OVERRIDE_CXX_ALLOCATION
511511
alignas(UnicodeString) char bytes[sizeof(UnicodeString)];
512512
UnicodeString *p;
513513
enum { len=20 };

0 commit comments

Comments
 (0)