Skip to content

Commit a568faf

Browse files
kahatlenHery Ramilison
authored andcommitted
Bug#25048573: STD::MAP INSTANTIATIONS CAUSE STATIC ASSERT FAILURES ON FREEBSD 11
Problem: Some instantiations of std::map have discrepancies between the value_type of the map and the value_type of the map's allocator. On FreeBSD 11 this is detected by Clang, and an error is raised at compilation time. Fix: Specify the correct value_type for the allocators. Also fix an unused variable warning in storage/innobase/os/os0file.cc. (cherry picked from commit 84407083481e8d98751252fa87501ec27f87ec48)
1 parent e924b76 commit a568faf

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

sql/json_dom.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef JSON_DOM_INCLUDED
22
#define JSON_DOM_INCLUDED
33

4-
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
4+
/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -368,7 +368,7 @@ struct Json_key_comparator
368368
Json_object class.
369369
*/
370370
typedef std::map<std::string, Json_dom *, Json_key_comparator,
371-
Malloc_allocator<std::pair<std::string, Json_dom *> > > Json_object_map;
371+
Malloc_allocator<std::pair<const std::string, Json_dom *> > > Json_object_map;
372372

373373
/**
374374
Represents a JSON container value of type "object" (ECMA), type

storage/innobase/buf/buf0buf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ typedef std::map<
339339
const byte*,
340340
buf_chunk_t*,
341341
std::less<const byte*>,
342-
ut_allocator<std::pair<const byte*, buf_chunk_t*> > >
342+
ut_allocator<std::pair<const byte* const, buf_chunk_t*> > >
343343
buf_pool_chunk_map_t;
344344

345345
static buf_pool_chunk_map_t* buf_chunk_map_reg;

storage/innobase/dict/dict0stats.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ then we would store 5,7,10,11,12 in the array. */
139139
typedef std::vector<ib_uint64_t, ut_allocator<ib_uint64_t> > boundaries_t;
140140

141141
/** Allocator type used for index_map_t. */
142-
typedef ut_allocator<std::pair<const char*, dict_index_t*> >
142+
typedef ut_allocator<std::pair<const char* const, dict_index_t*> >
143143
index_map_t_allocator;
144144

145145
/** Auxiliary map used for sorting indexes by name in dict_stats_save(). */

storage/innobase/os/os0file.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ static const size_t MAX_BLOCKS = 128;
116116
/** Block buffer size */
117117
#define BUFFER_BLOCK_SIZE ((ulint)(UNIV_PAGE_SIZE * 1.3))
118118

119-
/** Max disk sector size */
120-
static const ulint MAX_SECTOR_SIZE = 4096;
121-
122119
/** Disk sector size of aligning write buffer for DIRECT_IO */
123120
static ulint os_io_ptr_align = UNIV_SECTOR_SIZE;
124121

@@ -6601,6 +6598,10 @@ AIO::shutdown()
66016598
}
66026599

66036600
#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX)
6601+
6602+
/** Max disk sector size */
6603+
static const ulint MAX_SECTOR_SIZE = 4096;
6604+
66046605
/**
66056606
Try and get the FusionIO sector size. */
66066607
void

storage/innobase/sync/sync0debug.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ struct LatchDebug {
129129
os_thread_id_t,
130130
Latches*,
131131
os_thread_id_less,
132-
ut_allocator<std::pair<const std::string, latch_meta_t> > >
132+
ut_allocator<std::pair<const os_thread_id_t, Latches*> > >
133133
ThreadMap;
134134

135135
/** Constructor */
@@ -424,7 +424,7 @@ struct LatchDebug {
424424
latch_level_t,
425425
std::string,
426426
latch_level_less,
427-
ut_allocator<std::pair<latch_level_t, std::string> > >
427+
ut_allocator<std::pair<const latch_level_t, std::string> > >
428428
Levels;
429429

430430
/** Mutex protecting the deadlock detector data structures. */
@@ -1706,7 +1706,7 @@ struct CreateTracker {
17061706
const void*,
17071707
File,
17081708
std::less<const void*>,
1709-
ut_allocator<std::pair<const void*, File> > >
1709+
ut_allocator<std::pair<const void* const, File> > >
17101710
Files;
17111711

17121712
typedef OSMutex Mutex;

0 commit comments

Comments
 (0)