Commit 3c420a4
checkpatch: Adapt the braces check to Zephyr
scripts/checkpatch.pl was written originally for the Linux kernel, and
its code reflects the kernel's coding style. In particular, it has
checks for unneeded braces around single-statement if/else/for/while
conditions. In Zephyr however, braces are always required, and so the
checks needed modifying to verify the opposite condition.
In order to enable the now-compatible checks, we also remove the
--ignore BRACES statement in .checkpatch.conf.
Limitations: the current code works well if there are not conditional
statements (e.g. #if, #ifdef or #endif) next to the if/else/for/while
conditions. This is rarely the case, but triggers with the Bluetooth
controller in code like this:
```
#if defined(CONFIG_BT_PERIPHERAL)
if (!lll->is_hdcd)
#endif /* CONFIG_BT_PERIPHERAL */
{
```
```
} else
#endif /* CONFIG_BT_CTLR_PRIVACY */
{
```
```
#if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
if (lll->cte_started) {
radio_switch_complete(phy_s, 0, phy_s, 0);
} else
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
{
```
```
#ifdef DUAL_BANK
while ((FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW) ||
(FLASH_STM32_REGS(dev)->SR2 & FLASH_SR_QW))
#else
while (FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW)
#endif
{
```
Signed-off-by: Carles Cufi <[email protected]>1 parent 0f948fd commit 3c420a4
File tree
3 files changed
+32
-60
lines changed- doc/contribute
- scripts
3 files changed
+32
-60
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
548 | | - | |
549 | | - | |
| 548 | + | |
550 | 549 | | |
551 | 550 | | |
552 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5497 | 5497 | | |
5498 | 5498 | | |
5499 | 5499 | | |
5500 | | - | |
5501 | | - | |
| 5500 | + | |
| 5501 | + | |
| 5502 | + | |
5502 | 5503 | | |
5503 | 5504 | | |
5504 | 5505 | | |
| |||
5507 | 5508 | | |
5508 | 5509 | | |
5509 | 5510 | | |
| 5511 | + | |
| 5512 | + | |
| 5513 | + | |
| 5514 | + | |
| 5515 | + | |
5510 | 5516 | | |
5511 | 5517 | | |
5512 | 5518 | | |
5513 | | - | |
5514 | | - | |
5515 | | - | |
5516 | | - | |
5517 | | - | |
5518 | | - | |
5519 | | - | |
5520 | | - | |
5521 | | - | |
5522 | | - | |
5523 | | - | |
5524 | | - | |
5525 | | - | |
5526 | 5519 | | |
5527 | 5520 | | |
5528 | | - | |
5529 | | - | |
5530 | | - | |
5531 | | - | |
5532 | | - | |
5533 | | - | |
5534 | | - | |
5535 | | - | |
5536 | | - | |
5537 | | - | |
5538 | | - | |
5539 | | - | |
5540 | | - | |
| 5521 | + | |
| 5522 | + | |
| 5523 | + | |
| 5524 | + | |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
5541 | 5532 | | |
5542 | 5533 | | |
5543 | 5534 | | |
5544 | 5535 | | |
5545 | 5536 | | |
5546 | 5537 | | |
5547 | | - | |
5548 | | - | |
5549 | | - | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
| 5541 | + | |
5550 | 5542 | | |
5551 | 5543 | | |
5552 | 5544 | | |
| |||
5556 | 5548 | | |
5557 | 5549 | | |
5558 | 5550 | | |
5559 | | - | |
| 5551 | + | |
5560 | 5552 | | |
5561 | 5553 | | |
5562 | 5554 | | |
5563 | | - | |
5564 | | - | |
5565 | | - | |
5566 | | - | |
5567 | | - | |
5568 | | - | |
5569 | | - | |
5570 | | - | |
5571 | | - | |
5572 | | - | |
5573 | | - | |
5574 | | - | |
5575 | | - | |
5576 | | - | |
5577 | | - | |
5578 | | - | |
5579 | | - | |
5580 | | - | |
5581 | | - | |
5582 | | - | |
5583 | | - | |
5584 | | - | |
5585 | | - | |
5586 | | - | |
| 5555 | + | |
| 5556 | + | |
| 5557 | + | |
| 5558 | + | |
| 5559 | + | |
| 5560 | + | |
5587 | 5561 | | |
5588 | 5562 | | |
5589 | 5563 | | |
5590 | 5564 | | |
5591 | | - | |
| 5565 | + | |
5592 | 5566 | | |
5593 | 5567 | | |
5594 | 5568 | | |
| |||
0 commit comments