Commit de109e46 authored by unknown's avatar unknown

Fix signatures of placement operator delete in places where placement

delete is declared. As we don't use exceptions placement delete is never 
called and the fix only affects numerous warnings when
compiling with MS Visual C++.
For more info see http://www.gotw.ca/gotw/010.htm.


sql/item.h:
  Fix the signature of placement operator delete for class Item.
sql/sql_class.cc:
  Add placement delete operator to suppress a warning under Windows.
sql/sql_lex.h:
  Fix the signature of placement operator delete for class LEX
sql/sql_list.h:
  Fix the signature of placement operator delete for class Sql_alloc
sql/sql_string.h:
  Fix the signature of placement operator delete for class Sql_string
parent 92f55e98
...@@ -119,7 +119,7 @@ class Item { ...@@ -119,7 +119,7 @@ class Item {
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr,size_t size) {} static void operator delete(void *ptr,size_t size) {}
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) {} static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM, enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM,
INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM, INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM,
......
...@@ -707,6 +707,8 @@ struct Item_change_record: public ilink ...@@ -707,6 +707,8 @@ struct Item_change_record: public ilink
Item *old_value; Item *old_value;
/* Placement new was hidden by `new' in ilink (TODO: check): */ /* Placement new was hidden by `new' in ilink (TODO: check): */
static void *operator new(size_t size, void *mem) { return mem; } static void *operator new(size_t size, void *mem) { return mem; }
static void operator delete(void *ptr, size_t size) {}
static void operator delete(void *ptr, void *mem) { /* never called */ }
}; };
......
...@@ -241,7 +241,7 @@ class st_select_lex_node { ...@@ -241,7 +241,7 @@ class st_select_lex_node {
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr,size_t size) {} static void operator delete(void *ptr,size_t size) {}
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) {} static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {} st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {}
virtual ~st_select_lex_node() {} virtual ~st_select_lex_node() {}
inline st_select_lex_node* get_master() { return master; } inline st_select_lex_node* get_master() { return master; }
......
...@@ -41,8 +41,8 @@ class Sql_alloc ...@@ -41,8 +41,8 @@ class Sql_alloc
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr, size_t size, MEM_ROOT *mem_root) static void operator delete(void *ptr, MEM_ROOT *mem_root)
{ TRASH(ptr, size); } { /* never called */ }
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); } static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
#ifdef HAVE_purify #ifdef HAVE_purify
bool dummy; bool dummy;
......
...@@ -73,7 +73,7 @@ class String ...@@ -73,7 +73,7 @@ class String
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr_arg,size_t size) static void operator delete(void *ptr_arg,size_t size)
{} {}
static void operator delete(void *ptr_arg,size_t size, MEM_ROOT *mem_root) static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
{} {}
~String() { free(); } ~String() { free(); }
......
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