Skip to content

Commit 61b1b36

Browse files
align switch brackets (#396)
Signed-off-by: Cervenka Dusan <[email protected]> Co-authored-by: Michal Princ <[email protected]>
1 parent a8a7a0d commit 61b1b36

File tree

15 files changed

+280
-2
lines changed

15 files changed

+280
-2
lines changed

erpc_c/transports/erpc_i2c_slave_transport.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,39 +108,49 @@ static void I2C_SlaveUserCallback(I2C_Type *base, volatile i2c_slave_transfer_t
108108
{
109109
/* Address match event */
110110
case kI2C_SlaveAddressMatchEvent:
111+
{
111112
transfer->rxData = NULL;
112113
transfer->rxSize = 0;
113114
break;
115+
}
114116
/* Transmit request */
115117
case kI2C_SlaveTransmitEvent:
118+
{
116119
/* Update information for transmit process */
117120
transfer->txData = ((I2C_CLB_USER_DATA *)userData)->tx_buffer;
118121
transfer->txSize = ((I2C_CLB_USER_DATA *)userData)->tx_size;
119122
transfer->rxData = NULL;
120123
transfer->rxSize = 0;
121124
break;
125+
}
122126

123127
/* Setup the slave receive buffer */
124128
case kI2C_SlaveReceiveEvent:
129+
{
125130
/* Update information for received process */
126131
transfer->rxData = ((I2C_CLB_USER_DATA *)userData)->rx_buffer;
127132
transfer->rxSize = ((I2C_CLB_USER_DATA *)userData)->rx_size;
128133
transfer->txData = NULL;
129134
transfer->txSize = 0;
130135
break;
136+
}
131137

132138
/* The master has sent a stop transition on the bus */
133139
case kI2C_SlaveCompletionEvent:
140+
{
134141
transport->transfer_cb();
135142
transfer->rxData = NULL;
136143
transfer->rxSize = 0;
137144
transfer->txData = NULL;
138145
transfer->txSize = 0;
139146
break;
147+
}
140148

141149
default:
150+
{
142151
s_isTransferCompleted = false;
143152
break;
153+
}
144154
}
145155
}
146156

erpc_c/transports/erpc_lpi2c_slave_transport.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,25 @@ static void LPI2C_SlaveUserCallback(LPI2C_Type *base, lpi2c_slave_transfer_t *tr
108108
{
109109
/* Transmit request */
110110
case kLPI2C_SlaveTransmitEvent:
111+
{
111112
/* Update information for transmit process */
112113
transfer->data = ((LPI2C_CLB_USER_DATA *)userData)->tx_buffer;
113114
transfer->dataSize = ((LPI2C_CLB_USER_DATA *)userData)->tx_size;
114115
break;
116+
}
115117

116118
/* Setup the slave receive buffer */
117119
case kLPI2C_SlaveReceiveEvent:
120+
{
118121
/* Update information for received process */
119122
transfer->data = ((LPI2C_CLB_USER_DATA *)userData)->rx_buffer;
120123
transfer->dataSize = ((LPI2C_CLB_USER_DATA *)userData)->rx_size;
121124
break;
125+
}
122126

123127
/* The master has sent a stop transition on the bus */
124128
case kLPI2C_SlaveCompletionEvent:
129+
{
125130
/* Filter out dummy transaction completions (additional dummy recv./transmit) */
126131
if (!(transfer->transferredCount == 0 && transfer->dataSize == 0) && transfer->data != NULL)
127132
{
@@ -130,10 +135,13 @@ static void LPI2C_SlaveUserCallback(LPI2C_Type *base, lpi2c_slave_transfer_t *tr
130135
transfer->dataSize = 0;
131136
}
132137
break;
138+
}
133139

134140
default:
141+
{
135142
s_isTransferCompleted = false;
136143
break;
144+
}
137145
}
138146
}
139147

erpcgen/src/AstNode.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ string AstNode::getDescription() const
217217
case TOK_UNARY_NEGATE:
218218
case TOK_ARRAY:
219219
case TOK_UNION_CASE:
220+
{
220221
break;
222+
}
221223
default:
222224
{
223225
output += " " + valToString + " ";

erpcgen/src/AstWalker.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,49 +62,79 @@ void AstWalker::dispatch(AstNode *node)
6262
switch (tok.getToken())
6363
{
6464
case TOK_PROGRAM:
65+
{
6566
rewrite = handleProgram(node, dir);
6667
break;
68+
}
6769
case TOK_CHILDREN:
70+
{
6871
break;
72+
}
6973
case TOK_TYPE:
74+
{
7075
rewrite = handleType(node, dir);
7176
break;
77+
}
7278
case TOK_ENUM:
79+
{
7380
rewrite = handleEnum(node, dir);
7481
break;
82+
}
7583
case TOK_ENUM_MEMBER:
84+
{
7685
rewrite = handleEnumMember(node, dir);
7786
break;
87+
}
7888
case TOK_STRUCT:
89+
{
7990
rewrite = handleStruct(node, dir);
8091
break;
92+
}
8193
case TOK_STRUCT_MEMBER:
94+
{
8295
rewrite = handleStructMember(node, dir);
8396
break;
97+
}
8498
case TOK_UNION:
99+
{
85100
rewrite = handleUnion(node, dir);
86101
break;
102+
}
87103
case TOK_UNION_CASE:
104+
{
88105
rewrite = handleUnionCase(node, dir);
89106
break;
107+
}
90108
case TOK_INTERFACE:
109+
{
91110
rewrite = handleInterface(node, dir);
92111
break;
112+
}
93113
case TOK_FUNCTION:
114+
{
94115
rewrite = handleFunction(node, dir);
95116
break;
117+
}
96118
case TOK_PARAM:
119+
{
97120
rewrite = handleParam(node, dir);
98121
break;
122+
}
99123
case TOK_CONST:
124+
{
100125
rewrite = handleConst(node, dir);
101126
break;
127+
}
102128
case TOK_EXPR:
129+
{
103130
rewrite = handleExpr(node, dir);
104131
break;
132+
}
105133
case TOK_ANNOTATION:
134+
{
106135
rewrite = handleAnnotation(node, dir);
107136
break;
137+
}
108138
case '+':
109139
case '-':
110140
case '*':
@@ -115,12 +145,16 @@ void AstWalker::dispatch(AstNode *node)
115145
case '^':
116146
case TOK_LSHIFT:
117147
case TOK_RSHIFT:
148+
{
118149
rewrite = handleBinaryOp(node, dir);
119150
break;
151+
}
120152
case TOK_UNARY_NEGATE:
121153
case '~':
154+
{
122155
rewrite = handleUnaryOp(node, dir);
123156
break;
157+
}
124158
}
125159

126160
if (rewrite)

erpcgen/src/CGenerator.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,9 @@ void CGenerator::makeAliasesTemplateData()
821821
break;
822822
}
823823
default:
824+
{
824825
throw internal_error("Only structs or enums are allowed as unnamed types.");
826+
}
825827
}
826828
}
827829
aliases.push_back(aliasInfo);
@@ -2268,8 +2270,11 @@ string CGenerator::getTypenameName(DataType *t, const string &name)
22682270
break;
22692271
}
22702272
default:
2273+
{
22712274
throw internal_error(format_string("In getTypenameName: unknown data type: %s value:%d",
22722275
t->getName().c_str(), t->getDataType()));
2276+
break;
2277+
}
22732278
}
22742279
return returnName;
22752280
}
@@ -2279,35 +2284,65 @@ string CGenerator::getBuiltinTypename(const BuiltinType *t)
22792284
switch (t->getBuiltinType())
22802285
{
22812286
case BuiltinType::builtin_type_t::kBoolType:
2287+
{
22822288
return "bool";
2289+
}
22832290
case BuiltinType::builtin_type_t::kInt8Type:
2291+
{
22842292
return "int8_t";
2293+
}
22852294
case BuiltinType::builtin_type_t::kInt16Type:
2295+
{
22862296
return "int16_t";
2297+
}
22872298
case BuiltinType::builtin_type_t::kInt32Type:
2299+
{
22882300
return "int32_t";
2301+
}
22892302
case BuiltinType::builtin_type_t::kInt64Type:
2303+
{
22902304
return "int64_t";
2305+
}
22912306
case BuiltinType::builtin_type_t::kUInt8Type:
2307+
{
22922308
return "uint8_t";
2309+
}
22932310
case BuiltinType::builtin_type_t::kUInt16Type:
2311+
{
22942312
return "uint16_t";
2313+
}
22952314
case BuiltinType::builtin_type_t::kUInt32Type:
2315+
{
22962316
return "uint32_t";
2317+
}
22972318
case BuiltinType::builtin_type_t::kUInt64Type:
2319+
{
22982320
return "uint64_t";
2321+
}
22992322
case BuiltinType::builtin_type_t::kFloatType:
2323+
{
23002324
return "float";
2325+
}
23012326
case BuiltinType::builtin_type_t::kDoubleType:
2327+
{
23022328
return "double";
2329+
}
23032330
case BuiltinType::builtin_type_t::kStringType:
2331+
{
23042332
return "char *";
2333+
}
23052334
case BuiltinType::builtin_type_t::kUStringType:
2335+
{
23062336
return "unsigned char*";
2337+
}
23072338
case BuiltinType::builtin_type_t::kBinaryType:
2339+
{
23082340
return "uint8_t *";
2341+
}
23092342
default:
2343+
{
23102344
throw internal_error("unknown builtin type");
2345+
}
23112346
}
23122347
}
23132348

@@ -3039,7 +3074,9 @@ bool CGenerator::isNeedCallFree(DataType *dataType)
30393074
return false;
30403075
}
30413076
default:
3077+
{
30423078
return false;
3079+
}
30433080
}
30443081
}
30453082

@@ -3422,15 +3459,25 @@ string CGenerator::getDirection(param_direction_t direction)
34223459
switch (direction)
34233460
{
34243461
case param_direction_t::kInDirection:
3462+
{
34253463
return "kInDirection";
3464+
}
34263465
case param_direction_t::kOutDirection:
3466+
{
34273467
return "kOutDirection";
3468+
}
34283469
case param_direction_t::kInoutDirection:
3470+
{
34293471
return "kInoutDirection";
3472+
}
34303473
case param_direction_t::kReturn:
3474+
{
34313475
return "kReturn";
3476+
}
34323477
default:
3478+
{
34333479
throw semantic_error("Unsupported direction type");
3480+
}
34343481
}
34353482
}
34363483

0 commit comments

Comments
 (0)