summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-05-31 12:29:54 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-05-31 12:29:54 -0300
commita8c288054efb4de42cefa5bf06bcb487171ed9d3 (patch)
treebbbd0851e788a87bdf80dacc828f8de102b381b4 /sql/sql_test.cc
parente5bcb6f36ae784fb794a3363acf8ba75f937ca8b (diff)
downloadmariadb-git-a8c288054efb4de42cefa5bf06bcb487171ed9d3.tar.gz
Bug#53445: Build with -Wall and fix warnings that it generates
Fix various mismatches between function's language linkage. Any particular function that is declared in C++ but should be callable from C must have C linkage. Note that function types with different linkages are also distinct. Thus, if a function type is declared in C code, it will have C linkage (same if declared in a extern "C" block). client/mysql.cc: Mismatch between prototype and declaration. client/mysqltest.cc: mysqltest used to be C code. Use C linkage where appropriate. cmd-line-utils/readline/input.c: Isolate unreachable code. include/my_alloc.h: Function type must have C linkage. include/my_base.h: Function type must have C linkage. include/my_global.h: Add helper macros to avoid spurious namespace indentation. include/mysql.h.pp: Update ABI file. mysys/my_gethwaddr.c: Remove stray carriage return and fix coding style. plugin/semisync/semisync_master_plugin.cc: Callback function types have C linkage. plugin/semisync/semisync_slave_plugin.cc: Callback function types have C linkage. sql/derror.cc: Expected function type has C linkage. sql/field.cc: Use helper macro and fix indentation. sql/handler.cc: Expected function type has C linkage. sql/item_sum.cc: Correct function linkages. Remove now unnecessary cast. sql/item_sum.h: Add prototypes with the appropriate linkage as otherwise they are distinct. sql/mysqld.cc: Wrap functions in C linkage mode. sql/opt_range.cc: C language linkage is ignored for class member functions. sql/partition_info.cc: Add wrapper functions with C linkage for class member functions. sql/rpl_utility.h: Use helper macro and fix indentation. sql/sql_class.cc: Change type of thd argument -- THD is a class. Use helper macro and fix indentation. sql/sql_class.h: Change type of thd argument -- THD is a class. sql/sql_select.cc: Expected function type has C linkage. sql/sql_select.h: Move prototype to sql_test.h sql/sql_show.cc: Expected function type has C linkage. sql/sql_test.cc: Fix required function prototype and fix coding style. sql/sql_test.h: Removed unnecessary export and add another. storage/myisammrg/ha_myisammrg.cc: Expected function type has C linkage. storage/perfschema/pfs.cc: PSI headers are declared with C language linkage, which also applies to function types.
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc29
1 files changed, 22 insertions, 7 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index d34aee854d0..43d203e6498 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -76,7 +76,7 @@ print_where(COND *cond,const char *info, enum_query_type query_type)
/* This is for debugging purposes */
-void print_cached_tables(void)
+static void print_cached_tables(void)
{
uint idx,count,unused;
TABLE_SHARE *share;
@@ -341,6 +341,11 @@ print_plan(JOIN* join, uint idx, double record_count, double read_time,
#endif
+C_MODE_START
+static int dl_compare(const void *p1, const void *p2);
+static int print_key_cache_status(const char *name, KEY_CACHE *key_cache);
+C_MODE_END
+
typedef struct st_debug_lock
{
ulong thread_id;
@@ -350,8 +355,13 @@ typedef struct st_debug_lock
enum thr_lock_type type;
} TABLE_LOCK_INFO;
-static int dl_compare(TABLE_LOCK_INFO *a,TABLE_LOCK_INFO *b)
+static int dl_compare(const void *p1, const void *p2)
{
+ TABLE_LOCK_INFO *a, *b;
+
+ a= (TABLE_LOCK_INFO *) p1;
+ b= (TABLE_LOCK_INFO *) p2;
+
if (a->thread_id > b->thread_id)
return 1;
if (a->thread_id < b->thread_id)
@@ -401,9 +411,10 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data,
function so that we can easily add this if we ever need this.
*/
-static void display_table_locks(void)
+static void display_table_locks(void)
{
LIST *list;
+ void *saved_base;
DYNAMIC_ARRAY saved_table_locks;
(void) my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO), table_cache_count + 20,50);
@@ -424,13 +435,17 @@ static void display_table_locks(void)
mysql_mutex_unlock(&lock->mutex);
}
mysql_mutex_unlock(&THR_LOCK_lock);
- if (!saved_table_locks.elements) goto end;
-
- qsort((uchar*) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare);
+
+ if (!saved_table_locks.elements)
+ goto end;
+
+ saved_base= dynamic_element(&saved_table_locks, 0, TABLE_LOCK_INFO *);
+ my_qsort(saved_base, saved_table_locks.elements, sizeof(TABLE_LOCK_INFO),
+ dl_compare);
freeze_size(&saved_table_locks);
puts("\nThread database.table_name Locked/Waiting Lock_type\n");
-
+
unsigned int i;
for (i=0 ; i < saved_table_locks.elements ; i++)
{