1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
diff --git a/include/pqxx/compiler-public.hxx b/include/pqxx/compiler-public.hxx
index 5d24c7e..8087191 100644
--- a/include/pqxx/compiler-public.hxx
+++ b/include/pqxx/compiler-public.hxx
@@ -43,6 +43,11 @@
// Workarounds for Microsoft Visual C++
# ifdef _MSC_VER
+// Workarounds for deprecated attribute syntax error in Visual Studio 2017.
+# if _MSC_VER < 1920
+# define PQXX_DEPRECATED(MESSAGE) __declspec(deprecated( #MESSAGE ))
+# endif
+
// Suppress vtables on abstract classes.
# define PQXX_NOVTABLE __declspec(novtable)
@@ -112,6 +117,10 @@
# define PQXX_NOVTABLE /* novtable */
#endif
+#ifndef PQXX_DEPRECATED
+# define PQXX_DEPRECATED(MESSAGE) [[deprecated( #MESSAGE )]]
+#endif
+
// TODO: Assume support once we're on C++20.
#if defined(PQXX_HAVE_LIKELY)
# define PQXX_LIKELY [[likely]]
diff --git a/include/pqxx/stream_from.hxx b/include/pqxx/stream_from.hxx
index f2dcc31..6a74b55 100644
--- a/include/pqxx/stream_from.hxx
+++ b/include/pqxx/stream_from.hxx
@@ -148,7 +148,7 @@ public:
/** @deprecated Use factory function @c table() or @c raw_table() instead.
*/
template<typename Iter>
- [[deprecated("Use table() or raw_table() factory instead.")]] stream_from(
+ PQXX_DEPRECATED("Use table() or raw_table() factory instead.") stream_from(
transaction_base &, from_table_t, std::string_view table,
Iter columns_begin, Iter columns_end);
@@ -156,13 +156,13 @@ public:
/** @deprecated Use factory function @c query() instead.
*/
template<typename Columns>
- [[deprecated("Use table() or raw_table() factory instead.")]] stream_from(
+ PQXX_DEPRECATED("Use table() or raw_table() factory instead.") stream_from(
transaction_base &tx, from_table_t, std::string_view table,
Columns const &columns);
#include "pqxx/internal/ignore-deprecated-pre.hxx"
/// @deprecated Use factory function @c table() or @c raw_table() instead.
- [[deprecated("Use the from_table_t overload instead.")]] stream_from(
+ PQXX_DEPRECATED("Use the from_table_t overload instead.") stream_from(
transaction_base &tx, std::string_view table) :
stream_from{tx, from_table, table}
{}
@@ -170,14 +170,14 @@ public:
/// @deprecated Use factory function @c table() or @c raw_table() instead.
template<typename Columns>
- [[deprecated("Use the from_table_t overload instead.")]] stream_from(
+ PQXX_DEPRECATED("Use the from_table_t overload instead.") stream_from(
transaction_base &tx, std::string_view table, Columns const &columns) :
stream_from{tx, from_table, table, columns}
{}
/// @deprecated Use factory function @c table() or @c raw_table() instead.
template<typename Iter>
- [[deprecated("Use the from_table_t overload instead.")]] stream_from(
+ PQXX_DEPRECATED("Use the from_table_t overload instead.") stream_from(
transaction_base &, std::string_view table, Iter columns_begin,
Iter columns_end);
diff --git a/include/pqxx/stream_to.hxx b/include/pqxx/stream_to.hxx
index 3ad0292..4b52e31 100644
--- a/include/pqxx/stream_to.hxx
+++ b/include/pqxx/stream_to.hxx
@@ -168,7 +168,7 @@ public:
* your data fields and the table is explicit in your code, and not hidden
* in an "implicit contract" between your code and your schema.
*/
- [[deprecated("Use table() or raw_table() factory.")]] stream_to(
+ PQXX_DEPRECATED("Use table() or raw_table() factory.") stream_to(
transaction_base &tx, std::string_view table_name) :
stream_to{tx, table_name, ""sv}
{}
@@ -177,14 +177,14 @@ public:
/** @deprecated Use @c table() or @c raw_table() as a factory.
*/
template<typename Columns>
- [[deprecated("Use table() or raw_table() factory.")]] stream_to(
+ PQXX_DEPRECATED("Use table() or raw_table() factory.") stream_to(
transaction_base &, std::string_view table_name, Columns const &columns);
/// Create a stream, specifying column names as a sequence of strings.
/** @deprecated Use @c table() or @c raw_table() as a factory.
*/
template<typename Iter>
- [[deprecated("Use table() or raw_table() factory.")]] stream_to(
+ PQXX_DEPRECATED("Use table() or raw_table() factory.") stream_to(
transaction_base &, std::string_view table_name, Iter columns_begin,
Iter columns_end);
|