Skip to content

Commit 195935b

Browse files
committed
Merge branch 'series/1.1' into jdbc
2 parents 61007de + 8403b71 commit 195935b

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

driver/mysql_prepared_statement.cpp

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

3636
#include <iostream>
3737
#include <sstream>
38+
#include "mysql_util.h"
39+
DIAGNOSTIC_PUSH
40+
DISABLE_WARNING(-Wparentheses)
3841
#include <boost/variant.hpp>
3942
#include <boost/scoped_array.hpp>
40-
43+
DIAGNOSTIC_POP
4144
#include <cppconn/exception.h>
42-
#include "mysql_util.h"
4345
#include "mysql_connection.h"
4446
#include "mysql_statement.h"
4547
#include "mysql_prepared_statement.h"

driver/mysql_util.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,41 @@
126126
#define FALLTHROUGH
127127
#endif
128128

129+
/*
130+
Macros used to disable warnings for fragments of code.
131+
*/
132+
133+
#if defined __GNUC__ || defined __clang__
134+
135+
#define PRAGMA(X) _Pragma(#X)
136+
#define DISABLE_WARNING(W) PRAGMA(GCC diagnostic ignored #W)
137+
138+
#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
139+
#define DIAGNOSTIC_PUSH PRAGMA(GCC diagnostic push)
140+
#define DIAGNOSTIC_POP PRAGMA(GCC diagnostic pop)
141+
#else
142+
#define DIAGNOSTIC_PUSH
143+
#define DIAGNOSTIC_POP
144+
#endif
145+
146+
#elif defined _MSC_VER
147+
148+
149+
#define PRAGMA(X) __pragma(X)
150+
#define DISABLE_WARNING(W) PRAGMA(warning (disable:W))
151+
152+
#define DIAGNOSTIC_PUSH PRAGMA(warning (push))
153+
#define DIAGNOSTIC_POP PRAGMA(warning (pop))
154+
155+
#else
156+
157+
#define PRAGMA(X)
158+
#define DISABLE_WARNING(W)
159+
160+
#define DIAGNOSTIC_PUSH
161+
#define DIAGNOSTIC_POP
162+
163+
#endif
129164

130165
namespace sql
131166
{

0 commit comments

Comments
 (0)