Skip to content

Commit 87b947a

Browse files
Mizuchifacebook-github-bot
authored andcommitted
log deprecated opertions to scuba
Reviewed By: thedavekwon Differential Revision: D67885587 fbshipit-source-id: aeb1a1d374e81dba97a3d2a3697bd2e1b02b3abc
1 parent 9fff2f1 commit 87b947a

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

third-party/thrift/src/thrift/lib/cpp2/op/detail/ContainerPatch.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <thrift/lib/cpp/util/VarintUtils.h>
2828
#include <thrift/lib/cpp2/Adapter.h>
2929
#include <thrift/lib/cpp2/op/detail/BasePatch.h>
30+
#include <thrift/lib/cpp2/patch/detail/Scuba.h>
3031

3132
namespace apache::thrift::op::detail {
3233

@@ -127,7 +128,13 @@ class ListPatch : public BaseContainerPatch<Patch, ListPatch<Patch>> {
127128
return;
128129
}
129130

130-
DCHECK(data_.prepend()->empty()) << "Prepend in ListPatch is disallowed.";
131+
if (!data_.prepend()->empty()) {
132+
auto msg = "Prepend in ListPatch is disallowed.";
133+
LOG(DFATAL) << msg;
134+
patch::detail::logDeprecatedOperation(
135+
"ListPatch::Prepend", folly::pretty_name<T>(), msg);
136+
}
137+
131138
v.prepend(*data_.prepend());
132139
v.appendMulti(*data_.append());
133140
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <thrift/lib/cpp2/patch/detail/Scuba.h>
18+
19+
namespace apache::thrift::patch::detail {
20+
THRIFT_PLUGGABLE_FUNC_REGISTER(
21+
void,
22+
logDeprecatedOperation,
23+
std::string_view,
24+
std::string_view,
25+
std::string_view) {}
26+
} // namespace apache::thrift::patch::detail
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#pragma once
18+
19+
#include <string_view>
20+
#include <thrift/lib/cpp2/PluggableFunction.h>
21+
22+
namespace apache::thrift::patch::detail {
23+
THRIFT_PLUGGABLE_FUNC_DECLARE(
24+
void,
25+
logDeprecatedOperation,
26+
std::string_view operation,
27+
std::string_view type,
28+
std::string_view message);
29+
}

0 commit comments

Comments
 (0)