Skip to content

Commit ba1a99c

Browse files
author
Tor Didriksen
committed
Bug#26825211 BACKPORT FIX FOR #25643811 TO 5.7
Backport relevant parts of patch for: Bug #25643811: MYSQL DOES NOT COMPILE WITH GCC 7 Change-Id: Iafc7bc70b3621e12b484694ff927fb15e21ac5d2
1 parent 984cc2d commit ba1a99c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+199
-116
lines changed

client/mysqlbinlog.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,6 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
13101310
if (head->error == -1)
13111311
goto err;
13121312
break;
1313-
1314-
destroy_evt= TRUE;
13151313
}
13161314

13171315
case binary_log::INTVAR_EVENT:
@@ -1536,6 +1534,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
15361534
goto end;
15371535
}
15381536
}
1537+
// Fall through.
15391538
case binary_log::ROWS_QUERY_LOG_EVENT:
15401539
case binary_log::WRITE_ROWS_EVENT:
15411540
case binary_log::DELETE_ROWS_EVENT:

client/mysqldump.c

+1
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ static void print_xml_comment(FILE *xml_file, size_t len,
21172117
case '-':
21182118
if (*(comment_string + 1) == '-') /* Only one hyphen allowed. */
21192119
break;
2120+
// Fall through.
21202121
default:
21212122
fputc(*comment_string, xml_file);
21222123
break;

cmake/maintainer.cmake

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2010, 2017, 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
@@ -16,6 +16,15 @@
1616
# Common warning flags for GCC, G++, Clang and Clang++
1717
SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security -Wvla")
1818

19+
# The default =3 given by -Wextra is a bit too strict for our code.
20+
IF(CMAKE_COMPILER_IS_GNUCXX)
21+
MY_CHECK_CXX_COMPILER_FLAG("-Wimplicit-fallthrough=2"
22+
HAVE_IMPLICIT_FALLTHROUGH)
23+
IF(HAVE_IMPLICIT_FALLTHROUGH)
24+
SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wimplicit-fallthrough=2")
25+
ENDIF()
26+
ENDIF()
27+
1928
# Common warning flags for GCC and Clang
2029
SET(MY_C_WARNING_FLAGS
2130
"${MY_WARNING_FLAGS} -Wwrite-strings -Wdeclaration-after-statement")

extra/lz4/lz4frame.c

+1
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ size_t LZ4F_decompress(LZ4F_decompressionContext_t decompressionContext,
10911091
dctxPtr->tmpInTarget = minFHSize; /* minimum to attempt decode */
10921092
dctxPtr->dStage = dstage_storeHeader;
10931093
}
1094+
// Fall through.
10941095

10951096
case dstage_storeHeader:
10961097
{

extra/replace.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
@@ -177,6 +177,7 @@ char **argv[];
177177
break;
178178
case 'V':
179179
version=1;
180+
// Fall through.
180181
case 'I':
181182
case '?':
182183
help=1; /* Help text written */

libbinlogevents/src/binlog_event.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2011, 2017, 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
@@ -169,7 +169,7 @@ Log_event_header(const char* buf, uint16_t binlog_version)
169169
extra_headers are not used in the current version.
170170
@endverbatim
171171
*/
172-
172+
// Fall through.
173173
default:
174174
memcpy(&flags, buf + FLAGS_OFFSET, sizeof(flags));
175175
flags= le16toh(flags);

libbinlogevents/src/statement_events.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2014, 2017, 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
@@ -532,8 +532,8 @@ User_var_event(const char* buf, unsigned int event_len,
532532
(description_event->footer()->checksum_alg ==
533533
BINLOG_CHECKSUM_ALG_OFF));
534534
size_t data_written= (header()->data_written- checksum_verify);
535-
BAPI_ASSERT(((bytes_read == data_written) ? 0 : BINLOG_CHECKSUM_LEN)||
536-
((bytes_read == data_written - 1) ? 0 : BINLOG_CHECKSUM_LEN));
535+
BAPI_ASSERT(((bytes_read == data_written) ? false : true) ||
536+
((bytes_read == data_written - 1) ? false : true));
537537
#endif
538538
if ((header()->data_written - bytes_read) > 0)
539539
{

libmysqld/CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2017, 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
@@ -181,6 +181,16 @@ IF(HAVE_MISLEADING_INDENTATION)
181181
COMPILE_FLAGS "-Wno-misleading-indentation")
182182
ENDIF()
183183

184+
# gcc 7.2.0 complains:
185+
# boost/geometry/algorithms/detail/expand/indexed.hpp:81
186+
# *((void*)& box +24) may be used uninitialized
187+
MY_CHECK_CXX_COMPILER_FLAG("-Wmaybe-uninitialized" HAVE_MAYBE_UNINITIALIZED)
188+
IF(HAVE_MAYBE_UNINITIALIZED)
189+
ADD_COMPILE_FLAGS(
190+
../sql/geometry_rtree.cc
191+
COMPILE_FLAGS "-Wno-maybe-uninitialized")
192+
ENDIF()
193+
184194
# Handle out-of-source build from source package with possibly broken
185195
# bison. Copy bison output to from source to build directory, if not already
186196
# there

rapid/plugin/x/mysqlxtest_src/common/utils_mysql_parsing.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public License as
@@ -118,8 +118,8 @@ namespace shcore
118118
if (!is_hidden_command && !have_content)
119119
head = tail; // Skip over the comment.
120120

121-
break;
122121
}
122+
break;
123123

124124
case '-': // Possible single line comment.
125125
{

rapid/plugin/x/mysqlxtest_src/mysqlx_protocol.cc

+3
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ void XProtocol::authenticate_mysql41(const std::string &user, const std::string
557557

558558
case Mysqlx::ServerMessages::ERROR:
559559
throw_server_error(*static_cast<Mysqlx::Error*>(message.get()));
560+
break;
560561

561562
default:
562563
throw Error(CR_MALFORMED_PACKET, "Unexpected message received from server during authentication");
@@ -577,6 +578,7 @@ void XProtocol::authenticate_mysql41(const std::string &user, const std::string
577578

578579
case Mysqlx::ServerMessages::ERROR:
579580
throw_server_error(*static_cast<Mysqlx::Error*>(message.get()));
581+
break;
580582

581583
case Mysqlx::ServerMessages::NOTICE:
582584
dispatch_notice(static_cast<Mysqlx::Notice::Frame*>(message.get()));
@@ -618,6 +620,7 @@ void XProtocol::authenticate_plain(const std::string &user, const std::string &p
618620

619621
case Mysqlx::ServerMessages::ERROR:
620622
throw_server_error(*static_cast<Mysqlx::Error*>(message.get()));
623+
break;
621624

622625
case Mysqlx::ServerMessages::NOTICE:
623626
dispatch_notice(static_cast<Mysqlx::Notice::Frame*>(message.get()));

rapid/plugin/x/ngs/src/client.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void Client::handle_message(Request &request)
191191
}
192192
break;
193193
}
194-
/* no break */
194+
// Fall through.
195195

196196
default:
197197
// invalid message at this time

rapid/plugin/x/ngs/src/protocol/row_builder.cc

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public License as
@@ -126,16 +126,16 @@ static inline int count_leading_zeroes(int i, dec1 val)
126126
switch (i)
127127
{
128128
/* @note Intentional fallthrough in all case labels */
129-
case 9: if (val >= 1000000000) break; ++ret;
130-
case 8: if (val >= 100000000) break; ++ret;
131-
case 7: if (val >= 10000000) break; ++ret;
132-
case 6: if (val >= 1000000) break; ++ret;
133-
case 5: if (val >= 100000) break; ++ret;
134-
case 4: if (val >= 10000) break; ++ret;
135-
case 3: if (val >= 1000) break; ++ret;
136-
case 2: if (val >= 100) break; ++ret;
137-
case 1: if (val >= 10) break; ++ret;
138-
case 0: if (val >= 1) break; ++ret;
129+
case 9: if (val >= 1000000000) break; ++ret; // Fall through.
130+
case 8: if (val >= 100000000) break; ++ret; // Fall through.
131+
case 7: if (val >= 10000000) break; ++ret; // Fall through.
132+
case 6: if (val >= 1000000) break; ++ret; // Fall through.
133+
case 5: if (val >= 100000) break; ++ret; // Fall through.
134+
case 4: if (val >= 10000) break; ++ret; // Fall through.
135+
case 3: if (val >= 1000) break; ++ret; // Fall through.
136+
case 2: if (val >= 100) break; ++ret; // Fall through.
137+
case 1: if (val >= 10) break; ++ret; // Fall through.
138+
case 0: if (val >= 1) break; ++ret; // Fall through.
139139
default: { DBUG_ASSERT(FALSE); }
140140
}
141141
return ret;

rapid/plugin/x/src/expr_generator.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public License as
@@ -434,7 +434,7 @@ void Expression_generator::in_expression(const Mysqlx::Expr::Operator &arg, cons
434434
}
435435
break;
436436
}
437-
// missing "break;"? on purpose
437+
// Fall through.
438438

439439
default:
440440
m_qb.put("(");

regex/debug.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ FILE *d;
102102
int col = 0;
103103
int last;
104104
sopno offset = 2;
105-
char buf[10];
105+
char buf[20];
106106
# define GAP() { if (offset % 5 == 0) { \
107107
if (col > 40) { \
108108
fprintf(d, "\n\t"); \

sql-common/client.c

+1
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
18231823
break;
18241824
case OPT_pipe:
18251825
options->protocol = MYSQL_PROTOCOL_PIPE;
1826+
break;
18261827
case OPT_connect_timeout:
18271828
case OPT_timeout:
18281829
if (opt_arg)

sql-common/client_authentication.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2011, 2017, 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
@@ -84,7 +84,7 @@ RSA *rsa_init(MYSQL *mysql)
8484

8585
if (mysql->options.extension != NULL &&
8686
mysql->options.extension->server_public_key_path != NULL &&
87-
mysql->options.extension->server_public_key_path != '\0')
87+
mysql->options.extension->server_public_key_path[0] != '\0')
8888
{
8989
pub_key_file= fopen(mysql->options.extension->server_public_key_path,
9090
"r");

sql/CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,16 @@ IF(HAVE_MISLEADING_INDENTATION)
359359
COMPILE_FLAGS "-Wno-misleading-indentation")
360360
ENDIF()
361361

362+
# gcc 7.2.0 complains:
363+
# boost/geometry/algorithms/detail/expand/indexed.hpp:81
364+
# *((void*)& box +24) may be used uninitialized
365+
MY_CHECK_CXX_COMPILER_FLAG("-Wmaybe-uninitialized" HAVE_MAYBE_UNINITIALIZED)
366+
IF(HAVE_MAYBE_UNINITIALIZED)
367+
ADD_COMPILE_FLAGS(
368+
geometry_rtree.cc
369+
COMPILE_FLAGS "-Wno-maybe-uninitialized")
370+
ENDIF()
371+
362372
MY_CHECK_CXX_COMPILER_FLAG("-fno-builtin-memcmp" HAVE_NO_BUILTIN_MEMCMP)
363373
# See comments in filesort_compare-t.cc about __builtin_memcmp
364374
IF(HAVE_NO_BUILTIN_MEMCMP)

sql/binlog.cc

+1
Original file line numberDiff line numberDiff line change
@@ -4224,6 +4224,7 @@ read_gtids_from_binlog(const char *filename, Gtid_set *all_gtids,
42244224
DBUG_ASSERT(prev_gtids == NULL ? true : all_gtids != NULL ||
42254225
first_gtid != NULL);
42264226
}
4227+
// Fall through.
42274228
default:
42284229
// if we found any other event type without finding a
42294230
// previous_gtids_log_event, then the rest of this binlog

sql/binlog.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ class Stage_manager {
152152

153153
/** Lock for protecting the queue. */
154154
mysql_mutex_t m_lock;
155-
} MY_ATTRIBUTE((aligned(CPU_LEVEL1_DCACHE_LINESIZE)));
155+
/*
156+
This attribute did not have the desired effect, at least not according
157+
to -fsanitize=undefined with gcc 5.2.1
158+
Also: it fails to compile with gcc 7.2
159+
*/
160+
}; // MY_ATTRIBUTE((aligned(CPU_LEVEL1_DCACHE_LINESIZE)));
156161

157162
public:
158163
Stage_manager()

sql/events.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2005, 2017, 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
@@ -241,6 +241,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
241241
break;
242242
case INTERVAL_WEEK:
243243
expr/= 7;
244+
close_quote= FALSE;
245+
break;
244246
default:
245247
close_quote= FALSE;
246248
break;

sql/field.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2000, 2017, 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
@@ -10881,7 +10881,7 @@ bool Create_field::init(THD *thd, const char *fld_name,
1088110881
case MYSQL_TYPE_DATE:
1088210882
/* Old date type. */
1088310883
sql_type= MYSQL_TYPE_NEWDATE;
10884-
/* fall trough */
10884+
/* fall through */
1088510885
case MYSQL_TYPE_NEWDATE:
1088610886
length= MAX_DATE_WIDTH;
1088710887
break;

sql/item_func.cc

+2
Original file line numberDiff line numberDiff line change
@@ -2380,6 +2380,7 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value)
23802380
return decimal_value;
23812381
case E_DEC_DIV_ZERO:
23822382
signal_divide_by_null();
2383+
// Fall through.
23832384
default:
23842385
null_value= 1;
23852386
return 0;
@@ -6420,6 +6421,7 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
64206421
case STRING_RESULT:
64216422
if (str->copy(m_ptr, m_length, collation.collation))
64226423
str= 0; // EOM error
6424+
break;
64236425
case ROW_RESULT:
64246426
DBUG_ASSERT(1); // Impossible
64256427
break;

sql/item_geofunc.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,7 @@ bool Item_func_geomfromgeojson::fix_fields(THD *thd, Item **ref)
13811381
maybe_null= (args[0]->maybe_null || args[1]->maybe_null ||
13821382
args[2]->maybe_null);
13831383
}
1384+
// Fall through.
13841385
case 2:
13851386
{
13861387
// Validate options argument
@@ -1391,6 +1392,7 @@ bool Item_func_geomfromgeojson::fix_fields(THD *thd, Item **ref)
13911392
}
13921393
maybe_null= (args[0]->maybe_null || args[1]->maybe_null);
13931394
}
1395+
// Fall through.
13941396
case 1:
13951397
{
13961398
/*
@@ -1884,7 +1886,7 @@ append_geometry(Geometry::wkb_parser *parser, Json_object *geometry,
18841886
add_short_crs_urn,
18851887
add_long_crs_urn,
18861888
geometry_srid);
1887-
else if (Geometry::wkb_multilinestring)
1889+
else if (header.wkb_type == Geometry::wkb_multilinestring)
18881890
result= append_linestring(parser, points, mbr, calling_function,
18891891
max_decimal_digits,
18901892
add_bounding_box,

0 commit comments

Comments
 (0)