summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2013-06-14 10:52:23 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2013-06-14 10:52:23 +0200
commita040586cceab693b5b689afff841c785afa38e53 (patch)
tree635f7a3d45ec27024d2f7e63e79da82fdeb47273
parent9f7043ab91197decf382553e156aabc87d5f7451 (diff)
downloadmariadb-git-a040586cceab693b5b689afff841c785afa38e53.tar.gz
Bug#16729109: FIX COMPILATION WARNINGS WITH GCC 4.8
Backport to 5.5 (external Bug#69407 Build warnings with mysql)
-rw-r--r--include/my_global.h4
-rw-r--r--mysys/CMakeLists.txt7
-rw-r--r--sql/debug_sync.cc4
-rw-r--r--sql/field.cc6
-rw-r--r--storage/myisam/mi_checksum.c3
-rw-r--r--storage/myisam/mi_key.c4
-rw-r--r--storage/myisam/mi_packrec.c4
-rwxr-xr-xsupport-files/build-tags2
-rw-r--r--unittest/mysys/explain_filename-t.cc2
9 files changed, 20 insertions, 16 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 85f2078e361..0d43964234b 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -391,7 +391,7 @@ C_MODE_END
#define compile_time_assert(X) \
do \
{ \
- typedef char compile_time_assert[(X) ? 1 : -1]; \
+ typedef char compile_time_assert[(X) ? 1 : -1] __attribute__((unused)); \
} while(0)
#endif
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 814f093c2d6..95d3e568be7 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,6 +69,11 @@ TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
${LIBNSL} ${LIBM} ${LIBRT})
DTRACE_INSTRUMENT(mysys)
+# Need explicit pthread for gcc -fsanitize=address
+IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
+ TARGET_LINK_LIBRARIES(mysys pthread)
+ENDIF()
+
ADD_EXECUTABLE(thr_lock thr_lock.c)
TARGET_LINK_LIBRARIES(thr_lock mysys)
SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index 1575bca427c..1dc40c978d4 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1737,7 +1737,7 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
if (action->wait_for.length())
{
mysql_mutex_t *old_mutex;
- mysql_cond_t *old_cond;
+ mysql_cond_t *old_cond= NULL;
int error= 0;
struct timespec abstime;
diff --git a/sql/field.cc b/sql/field.cc
index 749d5d8047e..c65346423a0 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -7380,7 +7380,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
if (!String::needs_conversion(length, cs, field_charset, &dummy_offset))
{
Field_blob::store_length(length);
- bmove(ptr+packlength,(char*) &from,sizeof(char*));
+ bmove(ptr+packlength, &from, sizeof(char*));
return 0;
}
if (tmpstr.copy(from, length, cs))
@@ -7897,7 +7897,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
value.copy(from, length, cs);
from= value.ptr();
}
- bmove(ptr + packlength, (char*) &from, sizeof(char*));
+ bmove(ptr + packlength, &from, sizeof(char*));
}
return 0;
diff --git a/storage/myisam/mi_checksum.c b/storage/myisam/mi_checksum.c
index 3d95eb2b609..97503878e56 100644
--- a/storage/myisam/mi_checksum.c
+++ b/storage/myisam/mi_checksum.c
@@ -33,8 +33,7 @@ ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
length=_mi_calc_blob_length(rec->length-
portable_sizeof_char_ptr,
buf);
- memcpy((char*) &pos, buf+rec->length- portable_sizeof_char_ptr,
- sizeof(char*));
+ memcpy(&pos, buf+rec->length- portable_sizeof_char_ptr, sizeof(char*));
break;
}
case FIELD_VARCHAR:
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index 5c3d4922956..96b8c14c6ad 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -418,7 +418,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
goto err;
#endif
memcpy(record+keyseg->start+keyseg->bit_start,
- (char*) &blob_ptr,sizeof(char*));
+ &blob_ptr,sizeof(char*));
memcpy(blob_ptr,key,length);
blob_ptr+=length;
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index a1a03e20aaf..8548b3ebd94 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1051,7 +1051,7 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
}
decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length);
_my_store_blob_length((uchar*) to,pack_length,length);
- memcpy((char*) to+pack_length, &bit_buff->blob_pos, sizeof(char*));
+ memcpy(to+pack_length, &bit_buff->blob_pos, sizeof(char*));
bit_buff->blob_pos+=length;
}
}
diff --git a/support-files/build-tags b/support-files/build-tags
index b5386dc79c3..9c43e021c42 100755
--- a/support-files/build-tags
+++ b/support-files/build-tags
@@ -1,7 +1,7 @@
#! /bin/sh
rm -f TAGS
-filter='\.cc$\|\.c$\|\.h$\|\.yy$'
+filter='\.cc$\|\.c$\|\.h$\|sql_yacc\.yy$'
list="find . -type f"
bzr root >/dev/null 2>/dev/null && list="bzr ls --from-root -R --kind=file --versioned"
diff --git a/unittest/mysys/explain_filename-t.cc b/unittest/mysys/explain_filename-t.cc
index 09ebe1768df..7eda24fe5db 100644
--- a/unittest/mysys/explain_filename-t.cc
+++ b/unittest/mysys/explain_filename-t.cc
@@ -64,7 +64,7 @@ void test_1(const char *in, const char *exp, enum_explain_filename_mode mode)
int main()
{
setup();
- plan(NO_PLAN);
+ plan(22);
test_1("test/t1.ibd",
"Database \"test\", Table \"t1.ibd\"",