Skip to content

Commit f02ca42

Browse files
brad0dr-m
authored andcommitted
Revert aligned_alloc() addition from MDEV-28836
As pointed out with MDEV-29308 there are issues with the code as is. MariaDB is built as C++11 / C99. aligned_alloc() is not guarenteed to be exposed when building with any mode other than C++17 / C11. The other *BSD's have their stdlib.h header to expose the function with C+11 anyway, but the issue exists in the C99 code too, the build just does not use -Werror. Linux globally defines _GNU_SOURCE hiding the issue as well.
1 parent 7624bf8 commit f02ca42

File tree

5 files changed

+1
-17
lines changed

5 files changed

+1
-17
lines changed

cmake/os/WindowsCache.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ IF(MSVC)
2323
SET(BFD_H_EXISTS 0 CACHE INTERNAL "")
2424
SET(HAVE_ACCESS 1 CACHE INTERNAL "")
2525
SET(HAVE_ALARM CACHE INTERNAL "")
26-
SET(HAVE_ALIGNED_ALLOC CACHE INTERNAL "")
2726
SET(HAVE_ALLOCA_H CACHE INTERNAL "")
2827
SET(HAVE_ARPA_INET_H CACHE INTERNAL "")
2928
SET(HAVE_BACKTRACE CACHE INTERNAL "")

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
/* Headers we may want to use. */
2020
#cmakedefine STDC_HEADERS 1
2121
#cmakedefine _GNU_SOURCE 1
22-
#cmakedefine HAVE_ALIGNED_ALLOC 1
2322
#cmakedefine HAVE_ALLOCA_H 1
2423
#cmakedefine HAVE_ARPA_INET_H 1
2524
#cmakedefine HAVE_ASM_TERMBITS_H 1

configure.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,6 @@ ENDIF()
326326
CHECK_FUNCTION_EXISTS (accept4 HAVE_ACCEPT4)
327327
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
328328
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
329-
IF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT WITH_ASAN)
330-
# When an old custom memory allocator library is used, aligned_alloc()
331-
# could invoke the built-in allocator in libc, not matching
332-
# the overriden free() in the custom memory allocator.
333-
SET(HAVE_ALIGNED_ALLOC 0)
334-
ELSE()
335-
CHECK_FUNCTION_EXISTS (aligned_alloc HAVE_ALIGNED_ALLOC)
336-
ENDIF()
337329
SET(HAVE_ALLOCA 1)
338330
CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)
339331
CHECK_FUNCTION_EXISTS (backtrace_symbols HAVE_BACKTRACE_SYMBOLS)

include/aligned.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@
1414
along with this program; if not, write to the Free Software
1515
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
1616

17-
#ifdef HAVE_ALIGNED_ALLOC
18-
#elif defined __linux__
17+
#if defined __linux__
1918
# include <malloc.h>
2019
#endif
2120

2221
inline void *aligned_malloc(size_t size, size_t alignment)
2322
{
2423
#ifdef _WIN32
2524
return _aligned_malloc(size, alignment);
26-
#elif defined HAVE_ALIGNED_ALLOC
27-
return aligned_alloc(alignment, size);
2825
#elif defined __linux__
2926
return memalign(alignment, size);
3027
#else

storage/innobase/buf/buf0flu.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,6 @@ static void buf_tmp_reserve_compression_buf(buf_tmp_buffer_t* slot)
579579
size= size + LZO1X_1_15_MEM_COMPRESS;
580580
#elif defined HAVE_SNAPPY
581581
size= snappy_max_compressed_length(size);
582-
#endif
583-
#if defined HAVE_ALIGNED_ALLOC && (defined HAVE_LZO || defined HAVE_SNAPPY)
584-
size= MY_ALIGN(size, srv_page_size);
585582
#endif
586583
slot->comp_buf= static_cast<byte*>(aligned_malloc(size, srv_page_size));
587584
}

0 commit comments

Comments
 (0)