Skip to content

Commit a040586

Browse files
author
Tor Didriksen
committed
Bug#16729109: FIX COMPILATION WARNINGS WITH GCC 4.8
Backport to 5.5 (external Bug#69407 Build warnings with mysql)
1 parent 9f7043a commit a040586

9 files changed

Lines changed: 20 additions & 16 deletions

File tree

include/my_global.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -391,7 +391,7 @@ C_MODE_END
391391
#define compile_time_assert(X) \
392392
do \
393393
{ \
394-
typedef char compile_time_assert[(X) ? 1 : -1]; \
394+
typedef char compile_time_assert[(X) ? 1 : -1] __attribute__((unused)); \
395395
} while(0)
396396
#endif
397397

mysys/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# 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}
6969
${LIBNSL} ${LIBM} ${LIBRT})
7070
DTRACE_INSTRUMENT(mysys)
7171

72+
# Need explicit pthread for gcc -fsanitize=address
73+
IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
74+
TARGET_LINK_LIBRARIES(mysys pthread)
75+
ENDIF()
76+
7277
ADD_EXECUTABLE(thr_lock thr_lock.c)
7378
TARGET_LINK_LIBRARIES(thr_lock mysys)
7479
SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")

sql/debug_sync.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
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)
17371737
if (action->wait_for.length())
17381738
{
17391739
mysql_mutex_t *old_mutex;
1740-
mysql_cond_t *old_cond;
1740+
mysql_cond_t *old_cond= NULL;
17411741
int error= 0;
17421742
struct timespec abstime;
17431743

sql/field.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
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)
73807380
if (!String::needs_conversion(length, cs, field_charset, &dummy_offset))
73817381
{
73827382
Field_blob::store_length(length);
7383-
bmove(ptr+packlength,(char*) &from,sizeof(char*));
7383+
bmove(ptr+packlength, &from, sizeof(char*));
73847384
return 0;
73857385
}
73867386
if (tmpstr.copy(from, length, cs))
@@ -7897,7 +7897,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
78977897
value.copy(from, length, cs);
78987898
from= value.ptr();
78997899
}
7900-
bmove(ptr + packlength, (char*) &from, sizeof(char*));
7900+
bmove(ptr + packlength, &from, sizeof(char*));
79017901
}
79027902
return 0;
79037903

storage/myisam/mi_checksum.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
3333
length=_mi_calc_blob_length(rec->length-
3434
portable_sizeof_char_ptr,
3535
buf);
36-
memcpy((char*) &pos, buf+rec->length- portable_sizeof_char_ptr,
37-
sizeof(char*));
36+
memcpy(&pos, buf+rec->length- portable_sizeof_char_ptr, sizeof(char*));
3837
break;
3938
}
4039
case FIELD_VARCHAR:

storage/myisam/mi_key.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
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,
418418
goto err;
419419
#endif
420420
memcpy(record+keyseg->start+keyseg->bit_start,
421-
(char*) &blob_ptr,sizeof(char*));
421+
&blob_ptr,sizeof(char*));
422422
memcpy(blob_ptr,key,length);
423423
blob_ptr+=length;
424424

storage/myisam/mi_packrec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
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,
10511051
}
10521052
decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length);
10531053
_my_store_blob_length((uchar*) to,pack_length,length);
1054-
memcpy((char*) to+pack_length, &bit_buff->blob_pos, sizeof(char*));
1054+
memcpy(to+pack_length, &bit_buff->blob_pos, sizeof(char*));
10551055
bit_buff->blob_pos+=length;
10561056
}
10571057
}

support-files/build-tags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /bin/sh
22

33
rm -f TAGS
4-
filter='\.cc$\|\.c$\|\.h$\|\.yy$'
4+
filter='\.cc$\|\.c$\|\.h$\|sql_yacc\.yy$'
55

66
list="find . -type f"
77
bzr root >/dev/null 2>/dev/null && list="bzr ls --from-root -R --kind=file --versioned"

unittest/mysys/explain_filename-t.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void test_1(const char *in, const char *exp, enum_explain_filename_mode mode)
6464
int main()
6565
{
6666
setup();
67-
plan(NO_PLAN);
67+
plan(22);
6868

6969
test_1("test/t1.ibd",
7070
"Database \"test\", Table \"t1.ibd\"",

0 commit comments

Comments
 (0)