[Commits] a02d402: MDEV-9618 solaris sparc build fails on 10.1.

Alexey Botchkov holyfoot at askmonty.org
Wed May 4 10:45:29 EEST 2016


revision-id: a02d4023db42755b5cb7d0ccb0543fbe94d1b628 (mariadb-10.1.13-28-ga02d402)
parent(s): 5dd0c77e9239217457cf795d6380bdd3bf0808ad
committer: Alexey Botchkov
timestamp: 2016-05-04 11:42:39 +0400
message:

MDEV-9618 solaris sparc build fails on 10.1.

        Compiler there is strict about the C/C++ call model
        mixing in function variable assumptions.
        Fixed by adding some 'extern "C"' and changing
        '?' operator with 'if'.

---
 include/mysql/plugin_audit.h               |  8 ++++++++
 include/mysql/plugin_auth.h                |  9 +++++++++
 include/mysql/plugin_encryption.h          |  8 ++++++++
 include/mysql/plugin_ftparser.h            |  8 ++++++++
 include/mysql/plugin_password_validation.h |  9 +++++++++
 sql/encryption.cc                          | 16 +++++++++++++---
 6 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/include/mysql/plugin_audit.h b/include/mysql/plugin_audit.h
index 31589f0..cbdd659 100644
--- a/include/mysql/plugin_audit.h
+++ b/include/mysql/plugin_audit.h
@@ -23,6 +23,10 @@
 
 #include "plugin.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define MYSQL_AUDIT_CLASS_MASK_SIZE 1
 
 #define MYSQL_AUDIT_INTERFACE_VERSION 0x0302
@@ -175,4 +179,8 @@ struct st_mysql_audit
 };
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h
index 156fb38..d776ed7 100644
--- a/include/mysql/plugin_auth.h
+++ b/include/mysql/plugin_auth.h
@@ -31,6 +31,10 @@
 
 #include <mysql/plugin_auth_common.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* defines for MYSQL_SERVER_AUTH_INFO.password_used */
 
 #define PASSWORD_USED_NO         0
@@ -122,5 +126,10 @@ struct st_mysql_auth
   */
   int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info);
 };
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
diff --git a/include/mysql/plugin_encryption.h b/include/mysql/plugin_encryption.h
index 3f35c2b..5d08f6d 100644
--- a/include/mysql/plugin_encryption.h
+++ b/include/mysql/plugin_encryption.h
@@ -27,6 +27,10 @@
 
 #include <mysql/plugin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define MariaDB_ENCRYPTION_INTERFACE_VERSION 0x0300
 
 /**
@@ -114,5 +118,9 @@ struct st_mariadb_encryption
   */
   unsigned int (*encrypted_length)(unsigned int slen, unsigned int key_id, unsigned int key_version);
 };
+
+#ifdef __cplusplus
+}
+#endif
 #endif
 
diff --git a/include/mysql/plugin_ftparser.h b/include/mysql/plugin_ftparser.h
index 324fce7..4dace4e 100644
--- a/include/mysql/plugin_ftparser.h
+++ b/include/mysql/plugin_ftparser.h
@@ -18,6 +18,10 @@
 #define _my_plugin_ftparser_h
 #include "plugin.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*************************************************************************
   API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
 */
@@ -208,5 +212,9 @@ struct st_mysql_ftparser
 };
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
diff --git a/include/mysql/plugin_password_validation.h b/include/mysql/plugin_password_validation.h
index f3ca5c7..18c643e 100644
--- a/include/mysql/plugin_password_validation.h
+++ b/include/mysql/plugin_password_validation.h
@@ -26,6 +26,10 @@
 
 #include <mysql/plugin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0100
 
 /**
@@ -41,5 +45,10 @@ struct st_mariadb_password_validation
   int (*validate_password)(MYSQL_LEX_STRING *username,
                            MYSQL_LEX_STRING *password);
 };
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
diff --git a/sql/encryption.cc b/sql/encryption.cc
index 209b092..52aaef8 100644
--- a/sql/encryption.cc
+++ b/sql/encryption.cc
@@ -23,6 +23,8 @@
 static plugin_ref encryption_manager= 0;
 struct encryption_service_st encryption_handler;
 
+extern "C" {
+
 uint no_key(uint)
 {
   return ENCRYPTION_KEY_VERSION_INVALID;
@@ -41,6 +43,8 @@ static unsigned int get_length(unsigned int slen, unsigned int key_id,
   return my_aes_get_size(MY_AES_CBC, slen);
 }
 
+} /* extern "C" */
+
 int initialize_encryption_plugin(st_plugin_int *plugin)
 {
   if (encryption_manager)
@@ -57,9 +61,15 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
   st_mariadb_encryption *handle=
     (struct st_mariadb_encryption*) plugin->plugin->info;
 
-  encryption_handler.encryption_ctx_size_func=
-    handle->crypt_ctx_size ? handle->crypt_ctx_size :
-    (uint (*)(unsigned int, unsigned int))my_aes_ctx_size;
+  /*
+    Copmiler on Spark doesn't like the '?' operator here as it
+    belives the (uint (*)...) implies the C++ call model.
+  */
+  if (handle->crypt_ctx_size)
+    encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size;
+  else
+    encryption_handler.encryption_ctx_size_func=
+      (uint (*)(unsigned int, unsigned int))my_aes_ctx_size;
 
   encryption_handler.encryption_ctx_init_func=
     handle->crypt_ctx_init ? handle->crypt_ctx_init : ctx_init;


More information about the commits mailing list