Skip to content

Commit a02d402

Browse files
author
Alexey Botchkov
committed
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'.
1 parent 5dd0c77 commit a02d402

File tree

6 files changed

+55
-3
lines changed

6 files changed

+55
-3
lines changed

include/mysql/plugin_audit.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
#include "plugin.h"
2525

26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
2630
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
2731

2832
#define MYSQL_AUDIT_INTERFACE_VERSION 0x0302
@@ -175,4 +179,8 @@ struct st_mysql_audit
175179
};
176180

177181

182+
#ifdef __cplusplus
183+
}
184+
#endif
185+
178186
#endif

include/mysql/plugin_auth.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131

3232
#include <mysql/plugin_auth_common.h>
3333

34+
#ifdef __cplusplus
35+
extern "C" {
36+
#endif
37+
3438
/* defines for MYSQL_SERVER_AUTH_INFO.password_used */
3539

3640
#define PASSWORD_USED_NO 0
@@ -122,5 +126,10 @@ struct st_mysql_auth
122126
*/
123127
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info);
124128
};
129+
130+
#ifdef __cplusplus
131+
}
132+
#endif
133+
125134
#endif
126135

include/mysql/plugin_encryption.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#include <mysql/plugin.h>
2929

30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
3034
#define MariaDB_ENCRYPTION_INTERFACE_VERSION 0x0300
3135

3236
/**
@@ -114,5 +118,9 @@ struct st_mariadb_encryption
114118
*/
115119
unsigned int (*encrypted_length)(unsigned int slen, unsigned int key_id, unsigned int key_version);
116120
};
121+
122+
#ifdef __cplusplus
123+
}
124+
#endif
117125
#endif
118126

include/mysql/plugin_ftparser.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#define _my_plugin_ftparser_h
1919
#include "plugin.h"
2020

21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
2125
/*************************************************************************
2226
API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
2327
*/
@@ -208,5 +212,9 @@ struct st_mysql_ftparser
208212
};
209213

210214

215+
#ifdef __cplusplus
216+
}
217+
#endif
218+
211219
#endif
212220

include/mysql/plugin_password_validation.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
#include <mysql/plugin.h>
2828

29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
2933
#define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0100
3034

3135
/**
@@ -41,5 +45,10 @@ struct st_mariadb_password_validation
4145
int (*validate_password)(MYSQL_LEX_STRING *username,
4246
MYSQL_LEX_STRING *password);
4347
};
48+
49+
#ifdef __cplusplus
50+
}
51+
#endif
52+
4453
#endif
4554

sql/encryption.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
static plugin_ref encryption_manager= 0;
2424
struct encryption_service_st encryption_handler;
2525

26+
extern "C" {
27+
2628
uint no_key(uint)
2729
{
2830
return ENCRYPTION_KEY_VERSION_INVALID;
@@ -41,6 +43,8 @@ static unsigned int get_length(unsigned int slen, unsigned int key_id,
4143
return my_aes_get_size(MY_AES_CBC, slen);
4244
}
4345

46+
} /* extern "C" */
47+
4448
int initialize_encryption_plugin(st_plugin_int *plugin)
4549
{
4650
if (encryption_manager)
@@ -57,9 +61,15 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
5761
st_mariadb_encryption *handle=
5862
(struct st_mariadb_encryption*) plugin->plugin->info;
5963

60-
encryption_handler.encryption_ctx_size_func=
61-
handle->crypt_ctx_size ? handle->crypt_ctx_size :
62-
(uint (*)(unsigned int, unsigned int))my_aes_ctx_size;
64+
/*
65+
Copmiler on Spark doesn't like the '?' operator here as it
66+
belives the (uint (*)...) implies the C++ call model.
67+
*/
68+
if (handle->crypt_ctx_size)
69+
encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size;
70+
else
71+
encryption_handler.encryption_ctx_size_func=
72+
(uint (*)(unsigned int, unsigned int))my_aes_ctx_size;
6373

6474
encryption_handler.encryption_ctx_init_func=
6575
handle->crypt_ctx_init ? handle->crypt_ctx_init : ctx_init;

0 commit comments

Comments
 (0)