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 <carles.cufi@nordicsemi.no>
31 lines
772 B
Text
31 lines
772 B
Text
--emacs
|
|
--summary-file
|
|
--show-types
|
|
--max-line-length=100
|
|
--min-conf-desc-length=1
|
|
--typedefsfile=scripts/checkpatch/typedefsfile
|
|
|
|
--ignore PRINTK_WITHOUT_KERN_LEVEL
|
|
--ignore SPLIT_STRING
|
|
--ignore VOLATILE
|
|
--ignore CONFIG_EXPERIMENTAL
|
|
--ignore PREFER_KERNEL_TYPES
|
|
--ignore PREFER_SECTION
|
|
--ignore AVOID_EXTERNS
|
|
--ignore NETWORKING_BLOCK_COMMENT_STYLE
|
|
--ignore DATE_TIME
|
|
--ignore MINMAX
|
|
--ignore CONST_STRUCT
|
|
--ignore FILE_PATH_CHANGES
|
|
--ignore SPDX_LICENSE_TAG
|
|
--ignore C99_COMMENT_TOLERANCE
|
|
--ignore REPEATED_WORD
|
|
--ignore UNDOCUMENTED_DT_STRING
|
|
--ignore DT_SPLIT_BINDING_PATCH
|
|
--ignore DT_SCHEMA_BINDING_PATCH
|
|
--ignore TRAILING_SEMICOLON
|
|
--ignore COMPLEX_MACRO
|
|
--ignore MULTISTATEMENT_MACRO_USE_DO_WHILE
|
|
--ignore ENOSYS
|
|
--ignore IS_ENABLED_CONFIG
|
|
--ignore EXPORT_SYMBOL
|