diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-20 21:17:36 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-20 21:17:36 +0000 |
commit | 56e7b7eaede52e8d2123e909d7d42220f8c63143 (patch) | |
tree | 73e1dc4b2e53d68c3a9d5269f9140142ef08c187 /plugin | |
parent | 9d97e6010ebdeab0579a8371d01f34118c518b30 (diff) | |
download | mariadb-git-56e7b7eaede52e8d2123e909d7d42220f8c63143.tar.gz |
Make possible to use clang on Windows (clang-cl)
-DWITH_ASAN can be used as well now, on x64
Fix many clang-cl warnings.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/feedback/utils.cc | 8 | ||||
-rw-r--r-- | plugin/server_audit/server_audit.c | 7 | ||||
-rw-r--r-- | plugin/win_auth_client/common.cc | 2 | ||||
-rw-r--r-- | plugin/win_auth_client/common.h | 4 |
4 files changed, 15 insertions, 6 deletions
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc index 87893924b38..64510161691 100644 --- a/plugin/feedback/utils.cc +++ b/plugin/feedback/utils.cc @@ -92,15 +92,19 @@ static int uname(struct utsname *buf) { OSVERSIONINFOEX ver; ver.dwOSVersionInfoSize = (DWORD)sizeof(ver); + /* GetVersionEx got deprecated, we need it anyway, so disable deprecation warnings. */ #ifdef _MSC_VER #pragma warning (disable : 4996) #endif +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif if (!GetVersionEx((OSVERSIONINFO *)&ver)) return -1; buf->nodename[0]= 0; strcpy(buf->sysname, "Windows"); - sprintf(buf->release, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion); + sprintf(buf->release, "%d.%d", (int)ver.dwMajorVersion, (int)ver.dwMinorVersion); const char *version_str= get_os_version_name(&ver); if(version_str && version_str[0]) @@ -109,7 +113,7 @@ static int uname(struct utsname *buf) { /* Fallback for unknown versions, e.g "Windows <major_ver>.<minor_ver>" */ sprintf(buf->version, "Windows %d.%d%s", - ver.dwMajorVersion, ver.dwMinorVersion, + (int)ver.dwMajorVersion, (int)ver.dwMinorVersion, (ver.wProductType == VER_NT_WORKSTATION ? "" : " Server")); } diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 35d05f816c3..16e506626e5 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -438,6 +438,7 @@ static const char *syslog_facility_names[]= "LOG_LOCAL4", "LOG_LOCAL5", "LOG_LOCAL6", "LOG_LOCAL7", 0 }; +#ifndef _WIN32 static unsigned int syslog_facility_codes[]= { LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, @@ -452,6 +453,7 @@ static unsigned int syslog_facility_codes[]= LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7, }; +#endif static TYPELIB syslog_facility_typelib= { array_elements(syslog_facility_names) - 1, "syslog_facility_typelib", @@ -469,11 +471,13 @@ static const char *syslog_priority_names[]= 0 }; +#ifndef _WIN32 static unsigned int syslog_priority_codes[]= { LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG, }; +#endif static TYPELIB syslog_priority_typelib= { @@ -2106,6 +2110,7 @@ struct mysql_event_general_v8 static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8) { +#ifdef __linux__ #ifdef DBUG_OFF #ifdef __x86_64__ static const int cmd_off= 4200; @@ -2127,7 +2132,7 @@ static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8) static const int db_len_off= 68; #endif /*x86_64*/ #endif /*DBUG_OFF*/ - +#endif /* __linux__ */ struct mysql_event_general event; if (ev_v8->event_class != MYSQL_AUDIT_GENERAL_CLASS) diff --git a/plugin/win_auth_client/common.cc b/plugin/win_auth_client/common.cc index 1c872c07e14..8e4eb318252 100644 --- a/plugin/win_auth_client/common.cc +++ b/plugin/win_auth_client/common.cc @@ -504,7 +504,7 @@ const char* get_last_error_message(Error_message_buf buf) buf[0]= '\0'; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)buf, sizeof(buf), NULL ); + (LPTSTR)buf, ERRMSG_BUFSIZE , NULL ); return buf; } diff --git a/plugin/win_auth_client/common.h b/plugin/win_auth_client/common.h index 415294b1ed9..cd7dc8c2e66 100644 --- a/plugin/win_auth_client/common.h +++ b/plugin/win_auth_client/common.h @@ -77,8 +77,8 @@ void error_log_print(const char *fmt, ...) error_log_vprint(Level, fmt, args); va_end(args); } - -typedef char Error_message_buf[1024]; +#define ERRMSG_BUFSIZE 1024 +typedef char Error_message_buf[ERRMSG_BUFSIZE]; const char* get_last_error_message(Error_message_buf); |