File tree Expand file tree Collapse file tree 1 file changed +47
-6
lines changed Expand file tree Collapse file tree 1 file changed +47
-6
lines changed Original file line number Diff line number Diff line change @@ -1575,6 +1575,47 @@ Compliant example::
1575
1575
}
1576
1576
1577
1577
1578
+ ST-22: 'goto' statement shall not be used
1579
+ ==========================================
1580
+
1581
+ Compliant example::
1582
+
1583
+ uint32_t showcase(uint32_t param)
1584
+ {
1585
+ uint32_t ret;
1586
+
1587
+ if (param < 10U) {
1588
+ ret = 10U;
1589
+ } else {
1590
+ ret = param;
1591
+ /* do something */
1592
+ }
1593
+
1594
+ return ret;
1595
+ }
1596
+
1597
+ .. rst-class :: non-compliant-code
1598
+
1599
+ Non-compliant example::
1600
+
1601
+ uint32_t showcase(uint32_t param)
1602
+ {
1603
+ uint32_t ret;
1604
+
1605
+ if (param < 10U) {
1606
+ ret = 10U;
1607
+ goto done;
1608
+ } else {
1609
+ ret = param;
1610
+ }
1611
+
1612
+ /* do something */
1613
+
1614
+ done:
1615
+ return ret;
1616
+ }
1617
+
1618
+
1578
1619
1579
1620
Expressions
1580
1621
***********
@@ -3240,18 +3281,18 @@ NC-07: Function pointer shall be named with suffix 'fn'
3240
3281
3241
3282
Compliant example::
3242
3283
3243
- struct firmware_operations firmware_sbl_ops = {
3244
- .init = sbl_init_fn,
3245
- .get_rsdp = sbl_get_rsdp_fn,
3284
+ struct firmware_operations {
3285
+ void (*init_fn)(void);
3286
+ void *(*get_rsdp_fn)(void);
3246
3287
};
3247
3288
3248
3289
.. rst-class :: non-compliant-code
3249
3290
3250
3291
Non-compliant example::
3251
3292
3252
- struct firmware_operations firmware_sbl_ops = {
3253
- .init = sbl_init,
3254
- .get_rsdp = sbl_get_rsdp,
3293
+ struct firmware_operations {
3294
+ void (*init)(void);
3295
+ void *(*get_rsdp)(void);
3255
3296
};
3256
3297
3257
3298
You can’t perform that action at this time.
0 commit comments