summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2023-03-10 09:35:50 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2023-03-10 09:35:50 +0200
commitf169dfb41adcb637732507ed56d3038003170a15 (patch)
tree233560fbdc966f7674618431a8ef75375831651a /include
parent25c048066a9557d1aa506220316c6fa57be5da91 (diff)
parent08267ba0c88d2f3ba1bacee9bb9a1e4da921a60a (diff)
downloadmariadb-git-f169dfb41adcb637732507ed56d3038003170a15.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt3
-rw-r--r--include/my_alloca.h45
-rw-r--r--include/my_global.h8
-rw-r--r--include/my_sys.h14
-rw-r--r--include/mysql/service_encryption.h11
5 files changed, 54 insertions, 27 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 1024821e569..a82d1143649 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -37,6 +37,7 @@ SET(HEADERS
ma_dyncol.h
my_list.h
my_alloc.h
+ my_alloca.h
typelib.h
my_dbug.h
m_string.h
@@ -111,7 +112,9 @@ ${footer}
ENDMACRO()
INSTALL_COMPAT_HEADER(my_global.h "")
+INSTALL_COMPAT_HEADER(my_alloca.h "")
INSTALL_COMPAT_HEADER(my_config.h "")
+INSTALL_COMPAT_HEADER(my_alloca.h "")
INSTALL_COMPAT_HEADER(my_sys.h "")
INSTALL_COMPAT_HEADER(mysql_version.h "
#include <mariadb_version.h>
diff --git a/include/my_alloca.h b/include/my_alloca.h
new file mode 100644
index 00000000000..761c2adb890
--- /dev/null
+++ b/include/my_alloca.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2023, MariaDB Corporation.
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#ifndef MY_ALLOCA_INCLUDED
+#define MY_ALLOCA_INCLUDED
+
+#ifdef _WIN32
+#include <malloc.h> /*for alloca*/
+/*
+ MSVC may define "alloca" when compiling in /Ze mode
+ (with extensions from Microsoft), but otherwise only
+ the _alloca function is defined:
+*/
+#ifndef alloca
+#define alloca _alloca
+#endif
+#else
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+#endif
+
+#if defined(HAVE_ALLOCA)
+/*
+ If the GCC/LLVM compiler from the MinGW is used,
+ alloca may not be defined when using the MSVC CRT:
+*/
+#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && !defined(alloca)
+#define alloca __builtin_alloca
+#endif /* GNUC */
+#endif
+
+#endif /* MY_ALLOCA_INCLUDED */
diff --git a/include/my_global.h b/include/my_global.h
index 2789ecc0bd0..e89249ec890 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -322,13 +322,6 @@ C_MODE_END
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)
-#undef HAVE_ALLOCA
-#undef HAVE_ALLOCA_H
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#include <errno.h> /* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */
@@ -485,6 +478,7 @@ typedef unsigned short ushort;
#endif
#include <my_compiler.h>
+#include <my_alloca.h>
/*
Wen using the embedded library, users might run into link problems,
diff --git a/include/my_sys.h b/include/my_sys.h
index 892dde0fe82..d60153149ec 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -28,9 +28,7 @@ C_MODE_START
#include <m_ctype.h> /* for CHARSET_INFO */
#include <stdarg.h>
#include <typelib.h>
-#ifdef _WIN32
-#include <malloc.h> /*for alloca*/
-#endif
+#include <my_alloca.h>
#include <mysql/plugin.h>
#include <mysql/service_my_print_error.h>
@@ -193,16 +191,6 @@ my_bool my_test_if_thinly_provisioned(File handle);
extern my_bool my_may_have_atomic_write;
#if defined(HAVE_ALLOCA) && !defined(HAVE_valgrind)
-#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43)
-#pragma alloca
-#endif /* _AIX */
-#if defined(__MWERKS__)
-#undef alloca
-#define alloca _alloca
-#endif /* __MWERKS__ */
-#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
-#define alloca __builtin_alloca
-#endif /* GNUC */
#define my_alloca(SZ) alloca((size_t) (SZ))
#define my_afree(PTR) ((void)0)
#define MAX_ALLOCA_SZ 4096
diff --git a/include/mysql/service_encryption.h b/include/mysql/service_encryption.h
index 69d205a27e8..280b9c69e35 100644
--- a/include/mysql/service_encryption.h
+++ b/include/mysql/service_encryption.h
@@ -24,22 +24,19 @@
*provider* (encryption plugin).
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef MYSQL_ABI_CHECK
+#include <my_alloca.h>
#ifdef _WIN32
-#include <malloc.h>
#ifndef __cplusplus
#define inline __inline
#endif
#else
#include <stdlib.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
#endif
#endif
+
+#ifdef __cplusplus
+extern "C" {
#endif
/* returned from encryption_key_get_latest_version() */