Skip to content

Commit

Permalink
coding guidelines: comply with MISRA C:2012 Rule 20.7
Browse files Browse the repository at this point in the history
In particular:

- added missing parenthesis around macro argument expansion

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
  • Loading branch information
Abramo-Bagnara authored and nashif committed Mar 29, 2022
1 parent aba70ce commit 0861990
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions drivers/serial/uart_ns16550.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

#include "uart_ns16550.h"

#define INST_HAS_PCP_HELPER(inst) DT_INST_NODE_HAS_PROP(inst, pcp) ||
#define INST_HAS_DLF_HELPER(inst) DT_INST_NODE_HAS_PROP(inst, dlf) ||
#define INST_HAS_PCP_HELPER(inst) (DT_INST_NODE_HAS_PROP(inst, pcp)) ||
#define INST_HAS_DLF_HELPER(inst) (DT_INST_NODE_HAS_PROP(inst, dlf)) ||
#define INST_HAS_REG_SHIFT_HELPER(inst) \
DT_INST_NODE_HAS_PROP(inst, reg_shift) ||
(DT_INST_NODE_HAS_PROP(inst, reg_shift)) ||

#define UART_NS16550_PCP_ENABLED \
(DT_INST_FOREACH_STATUS_OKAY(INST_HAS_PCP_HELPER) 0)
Expand All @@ -50,7 +50,7 @@
#define UART_NS16550_REG_INTERVAL_ENABLED \
(DT_INST_FOREACH_STATUS_OKAY(INST_HAS_REG_SHIFT_HELPER) 0)

#if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)
#if (DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie))
BUILD_ASSERT(IS_ENABLED(CONFIG_PCIE), "NS16550(s) in DT need CONFIG_PCIE");
#include <drivers/pcie/pcie.h>
#endif
Expand Down Expand Up @@ -248,7 +248,7 @@ struct uart_ns16550_device_config {
#if UART_NS16550_REG_INTERVAL_ENABLED
uint8_t reg_interval;
#endif
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)
#if (DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie))
bool pcie;
pcie_bdf_t pcie_bdf;
pcie_id_t pcie_id;
Expand Down Expand Up @@ -350,7 +350,7 @@ static int uart_ns16550_configure(const struct device *dev,
ARG_UNUSED(dev_cfg);

#ifndef UART_NS16550_ACCESS_IOPORT
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)
#if (DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie))
if (dev_cfg->pcie) {
struct pcie_mbar mbar;

Expand Down
6 changes: 3 additions & 3 deletions include/devicetree/zephyr.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@

#endif /* DT_DOXYGEN */

#if DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_entropy), label)
#if (DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_entropy), label))
#define DT_CHOSEN_ZEPHYR_ENTROPY_LABEL DT_LABEL(DT_CHOSEN(zephyr_entropy))
#endif

#if DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_flash_controller), label)
#if (DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_flash_controller), label))
#define DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL \
DT_LABEL(DT_CHOSEN(zephyr_flash_controller))
#endif

#if DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_can_primary), label)
#if (DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_can_primary), label))
#define DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL \
DT_LABEL(DT_CHOSEN(zephyr_can_primary))
#endif
Expand Down
8 changes: 4 additions & 4 deletions include/linker/linker-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ extern char __rodata_region_size[];
extern char _vector_start[];
extern char _vector_end[];

#if DT_NODE_HAS_STATUS(_NODE_RESERVED, okay)
#if (DT_NODE_HAS_STATUS(_NODE_RESERVED, okay))
LINKER_DT_RESERVED_MEM_SYMBOLS()
#endif

Expand All @@ -275,7 +275,7 @@ extern char __gcov_bss_size[];
/* end address of image, used by newlib for the heap */
extern char _end[];

#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay)
#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay))
extern char __ccm_data_rom_start[];
extern char __ccm_start[];
extern char __ccm_data_start[];
Expand All @@ -287,14 +287,14 @@ extern char __ccm_noinit_end[];
extern char __ccm_end[];
#endif

#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay)
#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay))
extern char __itcm_start[];
extern char __itcm_end[];
extern char __itcm_size[];
extern char __itcm_load_start[];
#endif

#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay)
#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay))
extern char __dtcm_data_start[];
extern char __dtcm_data_end[];
extern char __dtcm_bss_start[];
Expand Down
4 changes: 2 additions & 2 deletions kernel/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ __boot_func
void z_bss_zero(void)
{
(void)memset(__bss_start, 0, (size_t)(__bss_end - __bss_start));
#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay)
#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay))
(void)memset(&__ccm_bss_start, 0,
((uint32_t) &__ccm_bss_end - (uint32_t) &__ccm_bss_start));
#endif
#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay)
#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay))
(void)memset(&__dtcm_bss_start, 0,
((uint32_t) &__dtcm_bss_end - (uint32_t) &__dtcm_bss_start));
#endif
Expand Down

0 comments on commit 0861990

Please sign in to comment.