Skip to content

Commit 868109d

Browse files
author
Bogdan Degtyariov
committed
Merge branch 'wl12611' Remove warnings from Visual Studio 2017
2 parents 23ebb99 + 9aff789 commit 868109d

34 files changed

+235
-112
lines changed

cdk/core/codec.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030

3131

3232
#include <mysql/cdk/codec.h>
33-
#include <sstream>
3433
#include "../parser/json_parser.h"
3534

36-
PUSH_SYS_WARNINGS
35+
PUSH_SYS_WARNINGS_CDK
36+
#include <sstream>
3737
#include <algorithm> // std::min
38-
POP_SYS_WARNINGS
38+
POP_SYS_WARNINGS_CDK
3939

4040
// Include Protobuf headers needed for decoding float numbers
4141

cdk/foundation/connection_openssl.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
//include socket_detail.h before ssl.h because it includes winsock2.h
3333
//which must be included before winsock.h
3434
#include "socket_detail.h"
35-
PUSH_SYS_WARNINGS
35+
PUSH_SYS_WARNINGS_CDK
3636
#include <openssl/ssl.h>
3737
#ifdef WITH_SSL_WOLFSSL
3838

@@ -45,7 +45,7 @@ PUSH_SYS_WARNINGS
4545
#else
4646
#include <openssl/err.h>
4747
#endif
48-
POP_SYS_WARNINGS
48+
POP_SYS_WARNINGS_CDK
4949
#include <mysql/cdk/foundation/error.h>
5050
#include <mysql/cdk/foundation/connection_openssl.h>
5151
#include <mysql/cdk/foundation/opaque_impl.i>
@@ -296,7 +296,11 @@ void connection_TLS_impl::do_connect()
296296
cdk::foundation::connection::TLS::Options::SSL_MODE::VERIFY_CA
297297
)
298298
{
299-
SSL_CTX_set_verify(m_tls_ctx, SSL_VERIFY_PEER , NULL);
299+
/*
300+
Warnings must be disabled because of a bug in Visual Studio 2017 compiler:
301+
https://developercommunity.visualstudio.com/content/problem/130244/c-warning-c5039-reported-for-nullptr-argument.html
302+
*/
303+
SSL_CTX_set_verify(m_tls_ctx, SSL_VERIFY_PEER, nullptr);
300304

301305
if (SSL_CTX_load_verify_locations(
302306
m_tls_ctx,
@@ -307,7 +311,7 @@ void connection_TLS_impl::do_connect()
307311
}
308312
else
309313
{
310-
SSL_CTX_set_verify(m_tls_ctx, SSL_VERIFY_NONE, 0);
314+
SSL_CTX_set_verify(m_tls_ctx, SSL_VERIFY_NONE, nullptr);
311315
}
312316

313317
m_tls = SSL_new(m_tls_ctx);

cdk/foundation/connection_tcpip.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ void Socket_base::flush()
419419
}
420420

421421

422-
DIAGNOSTIC_PUSH
422+
DIAGNOSTIC_PUSH_CDK
423423
#ifdef _MSC_VER
424424
// 4702 = unreachable code
425-
DISABLE_WARNING(4702)
425+
DISABLE_WARNING_CDK(4702)
426426
#endif // _MSC_VER
427427

428428
cdk::foundation::error_condition
@@ -445,7 +445,7 @@ error_category_io::do_default_error_condition(int errc) const
445445
return errc::no_error;
446446
}
447447

448-
DIAGNOSTIC_POP
448+
DIAGNOSTIC_POP_CDK
449449

450450

451451
bool

cdk/foundation/connection_tcpip_base.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
#ifndef IMPL_FOUNDATION_CONNECTION_TCPIP_BASE_H
3232
#define IMPL_FOUNDATION_CONNECTION_TCPIP_BASE_H
3333

34-
PUSH_SYS_WARNINGS
34+
PUSH_SYS_WARNINGS_CDK
3535
#include <sys/types.h>
36-
POP_SYS_WARNINGS
36+
POP_SYS_WARNINGS_CDK
3737

3838
#include "socket_detail.h"
3939

cdk/foundation/diagnostics.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
#include <mysql/cdk/foundation/diagnostics.h>
3232

33-
PUSH_SYS_WARNINGS
33+
PUSH_SYS_WARNINGS_CDK
3434
#include <algorithm>
35-
POP_SYS_WARNINGS
35+
POP_SYS_WARNINGS_CDK
3636

3737
using namespace cdk;
3838

cdk/foundation/error.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535

3636
#include <mysql/cdk/foundation/error.h>
3737

38-
PUSH_SYS_WARNINGS
38+
PUSH_SYS_WARNINGS_CDK
3939
#include <stdexcept>
4040
#include <sstream>
41-
POP_SYS_WARNINGS
41+
POP_SYS_WARNINGS_CDK
4242

4343

4444
namespace cdk {

cdk/foundation/socket_detail.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "socket_detail.h"
3232
#include <mysql/cdk/foundation/error.h>
3333
#include <mysql/cdk/foundation/connection_tcpip.h>
34-
PUSH_SYS_WARNINGS
34+
PUSH_SYS_WARNINGS_CDK
3535
#include "openssl/ssl.h"
3636

3737
// Wolfssl redefines close, which causes compiler errors in VS.
@@ -49,7 +49,7 @@ PUSH_SYS_WARNINGS
4949
#include <signal.h>
5050
#include <sys/un.h>
5151
#endif
52-
POP_SYS_WARNINGS
52+
POP_SYS_WARNINGS_CDK
5353

5454
using namespace std::chrono;
5555

@@ -75,10 +75,10 @@ class error_category_winsock : public error_category_base
7575
const char* name() const NOEXCEPT { return "winsock"; }
7676
std::string message(int) const;
7777

78-
DIAGNOSTIC_PUSH
78+
DIAGNOSTIC_PUSH_CDK
7979
#ifdef _MSC_VER
8080
// 4702 = unreachable code
81-
DISABLE_WARNING(4702)
81+
DISABLE_WARNING_CDK(4702)
8282
#endif // _MSC_VER
8383

8484
error_condition do_default_error_condition(int code) const
@@ -122,7 +122,7 @@ DIAGNOSTIC_PUSH
122122
}
123123
}
124124

125-
DIAGNOSTIC_POP
125+
DIAGNOSTIC_POP_CDK
126126

127127
bool do_equivalent(int code, const error_condition &ec) const
128128
{
@@ -201,10 +201,10 @@ class error_category_resolve : public error_category_base
201201
const char* name() const NOEXCEPT { return "resolve"; }
202202
std::string message(int code) const;
203203

204-
DIAGNOSTIC_PUSH
204+
DIAGNOSTIC_PUSH_CDK
205205
#ifdef _MSC_VER
206206
// 4702 = unreachable code
207-
DISABLE_WARNING(4702)
207+
DISABLE_WARNING_CDK(4702)
208208
#endif // _MSC_VER
209209

210210
error_condition do_default_error_condition(int code) const
@@ -250,7 +250,7 @@ DIAGNOSTIC_PUSH
250250
}
251251
}
252252

253-
DIAGNOSTIC_POP
253+
DIAGNOSTIC_POP_CDK
254254

255255
bool do_equivalent(int code, const error_condition &ec) const
256256
{
@@ -541,11 +541,11 @@ addrinfo* addrinfo_from_string(const char* host_name, unsigned short port)
541541
}
542542

543543

544-
DIAGNOSTIC_PUSH
544+
DIAGNOSTIC_PUSH_CDK
545545

546546
#ifdef _MSC_VER
547547
// 4189 = local variable is initialized but not referenced
548-
DISABLE_WARNING(4189)
548+
DISABLE_WARNING_CDK(4189)
549549
#endif
550550

551551
Socket connect(const char *host_name, unsigned short port,
@@ -650,7 +650,7 @@ Socket connect(const char *host_name, unsigned short port,
650650
return socket;
651651
}
652652

653-
DIAGNOSTIC_POP
653+
DIAGNOSTIC_POP_CDK
654654

655655
#ifndef _WIN32
656656
Socket connect(const char *path, uint64_t timeout_usec)
@@ -767,12 +767,12 @@ int select_one(Socket socket, Select_mode mode, bool wait,
767767
// to make select() return immediately
768768
timeval *select_timeout = &timeout_val;
769769

770-
DIAGNOSTIC_PUSH
770+
DIAGNOSTIC_PUSH_CDK
771771

772772
#ifdef _WIN32
773773
// 4548 = expression has no effect
774774
// This warning is generated by FD_SET
775-
DISABLE_WARNING(4548)
775+
DISABLE_WARNING_CDK(4548)
776776
#endif
777777

778778
fd_set socket_set;
@@ -783,7 +783,7 @@ DIAGNOSTIC_PUSH
783783
FD_ZERO(&except_set);
784784
FD_SET(socket, &except_set);
785785

786-
DIAGNOSTIC_POP
786+
DIAGNOSTIC_POP_CDK
787787

788788
if (wait)
789789
{

cdk/foundation/socket_detail.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define CDK_FOUNDATION_SOCKET_DETAIL_H
3333
#include <mysql/cdk/foundation/types.h>
3434

35-
PUSH_SYS_WARNINGS
35+
PUSH_SYS_WARNINGS_CDK
3636

3737
#ifdef _WIN32
3838

@@ -59,7 +59,7 @@ PUSH_SYS_WARNINGS
5959

6060
#endif
6161

62-
POP_SYS_WARNINGS
62+
POP_SYS_WARNINGS_CDK
6363

6464

6565
namespace cdk {

cdk/include/mysql/cdk/data_source.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333

3434
#include <mysql/cdk/foundation.h>
3535

36-
PUSH_SYS_WARNINGS
36+
PUSH_SYS_WARNINGS_CDK
3737
#include <functional>
3838
#include <algorithm>
3939
#include <set>
40-
POP_SYS_WARNINGS
40+
POP_SYS_WARNINGS_CDK
4141

4242

4343
namespace cdk {

cdk/include/mysql/cdk/foundation/cdk_time.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333

3434
#include "common.h"
3535

36-
PUSH_SYS_WARNINGS
36+
PUSH_SYS_WARNINGS_CDK
3737
#include <time.h>
38-
POP_SYS_WARNINGS
38+
POP_SYS_WARNINGS_CDK
3939

4040
namespace cdk {
4141
namespace foundation {

cdk/include/mysql/cdk/foundation/codec.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333

3434
#include "types.h"
3535
#include "error.h"
36+
37+
PUSH_SYS_WARNINGS_CDK
38+
3639
#ifdef HAVE_CODECVT_UTF8
3740
#include <codecvt>
3841
#else
@@ -42,6 +45,7 @@
4245
#include <limits> // for std::numeric_limits
4346
#include <string.h> // for memset
4447

48+
POP_SYS_WARNINGS_CDK
4549

4650
namespace cdk {
4751
namespace foundation {

0 commit comments

Comments
 (0)