Commit 8fe04a3d authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Windows, compile : reenable previously disabled warning C4291

no matching operator delete found; memory will not be freed if initialization throws an exception

Added a no-op delete() for MEM_ROOT based placement-new()
parent 282b6520
......@@ -147,7 +147,7 @@ IF(MSVC)
#TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /we4700 /we4311 /we4477 /we4302 /we4090")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4291 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)
IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
......
......@@ -247,7 +247,7 @@ class ACL_USER_BASE :public ACL_ACCESS
public:
static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, size); }
static void operator delete(void *, MEM_ROOT *){}
uchar flags; // field used to store various state information
LEX_CSTRING user;
/* list to hold references to granted roles (ACL_ROLE instances) */
......
......@@ -37,11 +37,10 @@ class Sql_alloc
}
static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
{ return alloc_root(mem_root, size); }
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return alloc_root(mem_root, size); }
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr, MEM_ROOT *mem_root)
{ /* never called */ }
static void operator delete(void *, MEM_ROOT *){}
static void operator delete[](void *ptr, MEM_ROOT *mem_root)
{ /* never called */ }
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
......
......@@ -62,6 +62,7 @@ class Server_side_cursor: protected Query_arena, public Sql_alloc
virtual ~Server_side_cursor();
static void operator delete(void *ptr, size_t size);
static void operator delete(void *, MEM_ROOT *){}
};
......
......@@ -130,6 +130,7 @@ class Ed_result_set: public Sql_alloc
size_t get_field_count() const { return m_column_count; }
static void operator delete(void *ptr, size_t size) throw ();
static void operator delete(void *, MEM_ROOT *){}
private:
Ed_result_set(const Ed_result_set &); /* not implemented */
Ed_result_set &operator=(Ed_result_set &); /* not implemented */
......
......@@ -13355,6 +13355,8 @@ class COND_CMP :public ilink {
size_t size __attribute__((unused)))
{ TRASH(ptr, size); }
static void operator delete(void *, MEM_ROOT*) {}
Item *and_level;
Item_bool_func2 *cmp_func;
COND_CMP(Item *a,Item_bool_func2 *b) :and_level(a),cmp_func(b) {}
......
......@@ -2115,6 +2115,7 @@ class Virtual_tmp_table: public TABLE
*/
static void *operator new(size_t size, THD *thd) throw();
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
static void operator delete(void *, THD *) throw(){}
Virtual_tmp_table(THD *thd)
{
......
......@@ -2699,6 +2699,7 @@ class thread_info :public ilink {
static void operator delete(void *ptr __attribute__((unused)),
size_t size __attribute__((unused)))
{ TRASH(ptr, size); }
static void operator delete(void *, MEM_ROOT *){}
my_thread_id thread_id;
uint32 os_thread_id;
......
......@@ -170,6 +170,8 @@ class federatedx_io
{ return alloc_root(mem_root, size); }
static void operator delete(void *ptr, size_t size)
{ TRASH(ptr, size); }
static void operator delete(void *, MEM_ROOT *)
{ }
virtual int query(const char *buffer, size_t length)=0;
virtual FEDERATEDX_IO_RESULT *store_result()=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment