mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
chore: give up on InlinedVector due to spurious warnings with optional (#3765)
This commit is contained in:
parent
7df95dfb6e
commit
9c49aee43d
2 changed files with 4 additions and 10 deletions
|
@ -4,8 +4,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <absl/container/inlined_vector.h>
|
||||
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
@ -98,7 +96,7 @@ template <typename T> class JsonCallbackResult {
|
|||
JsonCallbackResult() {
|
||||
}
|
||||
|
||||
explicit JsonCallbackResult(CallbackResultOptions options) : options_(options) {
|
||||
explicit JsonCallbackResult(CallbackResultOptions options) : options_(std::move(options)) {
|
||||
}
|
||||
|
||||
void AddValue(T value) {
|
||||
|
@ -119,8 +117,8 @@ template <typename T> class JsonCallbackResult {
|
|||
return result_.front();
|
||||
}
|
||||
|
||||
const absl::InlinedVector<T, 2>& AsV2() const {
|
||||
return std::move(result_);
|
||||
const auto& AsV2() const {
|
||||
return result_;
|
||||
}
|
||||
|
||||
bool Empty() const {
|
||||
|
@ -144,7 +142,7 @@ template <typename T> class JsonCallbackResult {
|
|||
}
|
||||
|
||||
private:
|
||||
absl::InlinedVector<T, 2> result_;
|
||||
std::vector<T> result_;
|
||||
CallbackResultOptions options_{kDefaultJsonPathType};
|
||||
};
|
||||
|
||||
|
|
|
@ -593,13 +593,9 @@ OpResult<JsonCallbackResult<T>> JsonEvaluateOperation(const OpArgs& op_args, std
|
|||
EvaluateOperationOptions options = {}) {
|
||||
OpResult<JsonType*> result = GetJson(op_args, key);
|
||||
if (options.return_nil_if_key_not_found && result == OpStatus::KEY_NOTFOUND) {
|
||||
// GCC 13.1 throws spurious warnings around this code.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
return JsonCallbackResult<T>{
|
||||
{JsonPathType::kLegacy, options.cb_result_options.saving_order,
|
||||
CallbackResultOptions::OnEmpty::kSendNil}}; // set legacy mode to return nil
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
RETURN_ON_BAD_STATUS(result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue