Skip to content

Commit 6684709

Browse files
iahsmeta-codesync[bot]
authored andcommitted
Migrate deprecated_terse_writes from thrift_cpp2_options to field-level @cpp.DeprecatedTerseWrite (#538)
Summary: Pull Request resolved: #538 The `deprecated_terse_writes` option in `thrift_cpp2_options` applies globally to all fields. This diff migrates the behavior to per-field `cpp.DeprecatedTerseWrite` structured annotations, which is the preferred approach. Changes to the carbon compiler (`cppgen.py` and `targets.py`): - Add `cpp.DeprecatedTerseWrite` annotation to each non-optional, non-structured-type field in generated `.thrift` files - Remove `deprecated_terse_writes` from `thrift_cpp2_options` in generated `BUCK` files - Skip the annotation for structured types (structs, unions, exceptions) since `cpp.DeprecatedTerseWrite` is not supported on them All 28 IDL files regenerated. Reviewed By: vitaut Differential Revision: D97542094 fbshipit-source-id: fd0684d2f9ca69e793ed2ef9628e070ec7e15a14
1 parent b7927a1 commit 6684709

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

packages/ucache_bench/protocol/gen/UcacheBench.thrift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct UcacheBenchRequestCommon {
2929
2: optional string bucketId
3030
}
3131
struct UcacheBenchReplyCommon {
32+
@cpp.DeprecatedTerseWrite
3233
1: carbon.ui32 replySourceBitMask
3334
}
3435
@thrift.DeprecatedUnvalidatedAnnotations{
@@ -39,7 +40,9 @@ struct UcacheBenchReplyCommon {
3940
struct UcbGetRequest {
4041
@thrift.Mixin
4142
-1: UcacheBenchRequestCommon ucacheBenchRequestCommon
43+
@cpp.DeprecatedTerseWrite
4244
1: carbon.IOBufKey key
45+
@cpp.DeprecatedTerseWrite
4346
2: carbon.ui64 flags
4447
}
4548
@thrift.DeprecatedUnvalidatedAnnotations{
@@ -50,10 +53,14 @@ struct UcbGetRequest {
5053
struct UcbGetReply {
5154
@thrift.Mixin
5255
-1: UcacheBenchReplyCommon ucacheBenchReplyCommon
56+
@cpp.DeprecatedTerseWrite
5357
1: carbon_result.Result result
5458
2: optional carbon.IOBuf value
59+
@cpp.DeprecatedTerseWrite
5560
3: carbon.ui64 flags
61+
@cpp.DeprecatedTerseWrite
5662
4: string message
63+
@cpp.DeprecatedTerseWrite
5764
5: i16 appSpecificErrorCode
5865
6: optional i32 exptime
5966
}
@@ -65,9 +72,13 @@ struct UcbGetReply {
6572
struct UcbSetRequest {
6673
@thrift.Mixin
6774
-1: UcacheBenchRequestCommon ucacheBenchRequestCommon
75+
@cpp.DeprecatedTerseWrite
6876
1: carbon.IOBufKey key
77+
@cpp.DeprecatedTerseWrite
6978
2: i32 exptime
79+
@cpp.DeprecatedTerseWrite
7080
3: carbon.ui64 flags
81+
@cpp.DeprecatedTerseWrite
7182
4: carbon.IOBuf value
7283
}
7384
@thrift.DeprecatedUnvalidatedAnnotations{
@@ -78,10 +89,15 @@ struct UcbSetRequest {
7889
struct UcbSetReply {
7990
@thrift.Mixin
8091
-1: UcacheBenchReplyCommon ucacheBenchReplyCommon
92+
@cpp.DeprecatedTerseWrite
8193
1: carbon_result.Result result
94+
@cpp.DeprecatedTerseWrite
8295
2: carbon.ui64 flags
96+
@cpp.DeprecatedTerseWrite
8397
3: carbon.IOBuf value
98+
@cpp.DeprecatedTerseWrite
8499
4: string message
100+
@cpp.DeprecatedTerseWrite
85101
5: i16 appSpecificErrorCode
86102
}
87103
@thrift.DeprecatedUnvalidatedAnnotations{
@@ -92,7 +108,9 @@ struct UcbSetReply {
92108
struct UcbDeleteRequest {
93109
@thrift.Mixin
94110
-1: UcacheBenchRequestCommon ucacheBenchRequestCommon
111+
@cpp.DeprecatedTerseWrite
95112
1: carbon.IOBufKey key
113+
@cpp.DeprecatedTerseWrite
96114
2: carbon.ui64 flags
97115
}
98116
@thrift.DeprecatedUnvalidatedAnnotations{
@@ -103,9 +121,13 @@ struct UcbDeleteRequest {
103121
struct UcbDeleteReply {
104122
@thrift.Mixin
105123
-1: UcacheBenchReplyCommon ucacheBenchReplyCommon
124+
@cpp.DeprecatedTerseWrite
106125
1: carbon_result.Result result
126+
@cpp.DeprecatedTerseWrite
107127
2: carbon.ui64 flags
128+
@cpp.DeprecatedTerseWrite
108129
3: string message
130+
@cpp.DeprecatedTerseWrite
109131
4: i16 appSpecificErrorCode
110132
}
111133

0 commit comments

Comments
 (0)