Skip to content

Commit 2a40b0f

Browse files
authored
CXX-3325 condition fix on GCC version (#1456)
Restore support for GCC 4.8. GCC 4.8 is still supported in v4.1 releases.
1 parent 975ae7f commit 2a40b0f

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Changes prior to 3.9.0 are documented as [release notes on GitHub](https://githu
1212
### Fixed
1313

1414
- `storage_engine() const` in `mongocxx::v_noabi::options::index` is correctly exported using mongocxx export macros instead of bsoncxx export macros.
15+
- Fix `-Wdeprecated-literal-operator` warning.
1516

1617
## 4.1.1
1718

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ BSONCXX_ABI_EXPORT_CDECL(document::value) from_json(stdx::string_view json);
8282
///
8383
/// @throws bsoncxx::v_noabi::exception with error details if the conversion failed.
8484
///
85+
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8)) && !defined(__clang__)
86+
BSONCXX_ABI_EXPORT_CDECL(document::value) operator"" _bson(char const* json, size_t len);
87+
#else
8588
BSONCXX_ABI_EXPORT_CDECL(document::value) operator""_bson(char const* json, size_t len);
89+
#endif // GCC <= 4.8
8690

8791
} // namespace v_noabi
8892
} // namespace bsoncxx
@@ -92,7 +96,11 @@ namespace bsoncxx {
9296
using ::bsoncxx::v_noabi::from_json;
9397
using ::bsoncxx::v_noabi::to_json;
9498

99+
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8)) && !defined(__clang__)
100+
using ::bsoncxx::v_noabi::operator"" _bson;
101+
#else
95102
using ::bsoncxx::v_noabi::operator""_bson;
103+
#endif // GCC <= 4.8
96104

97105
} // namespace bsoncxx
98106

src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ document::value from_json(stdx::string_view json) {
107107
return document::value{buf, length, bson_free_deleter};
108108
}
109109

110+
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8)) && !defined(__clang__)
111+
document::value operator"" _bson(char const* str, size_t len) {
112+
#else
110113
document::value operator""_bson(char const* str, size_t len) {
114+
#endif // GCC <= 4.8
111115
return from_json(stdx::string_view{str, len});
112116
}
113117

0 commit comments

Comments
 (0)