We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building drivers/src/nrfx_dppi.c with clang for the nrf5340 results in the following warning:
drivers/src/nrfx_dppi.c drivers/src/nrfx_dppi.c:65:47: error: shift count >= width of type [-Werror,-Wshift-count-overflow] 65 | static nrfx_atomic_t m_allocated_channels = DPPI_AVAILABLE_CHANNELS_MASK; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/src/nrfx_dppi.c:56:17: note: expanded from macro 'DPPI_AVAILABLE_CHANNELS_MASK' 56 | ((uint32_t)(NRFX_BIT_MASK(NRF_DPPI_CH_NUM_MAX) & (~NRFX_DPPI_CHANNELS_USED))) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/nrfx_common.h:139:60: note: expanded from macro 'NRFX_BIT_MASK' 139 | #define NRFX_BIT_MASK(x) (((x) == 32) ? UINT32_MAX : ((1UL << (x)) - 1)) | ^ ~~~
Note, this is the expansion of this macro as it will be compiled:
static atomic_t m_allocated_channels = ((uint32_t)(((((((32)) > ((((0)) > (0) ? ((0)) : (0))) ? ((32)) : ((((0)) > (0) ? ((0)) : (0))))) == 32) ? (4294967295U) : ((1UL << ((((32)) > ((((0)) > (0) ? ((0)) : (0))) ? ((32)) : ((((0)) > (0) ? ((0)) : (0)))))) - 1)) & (~(0 | 0 | 0))));
(Note the preprocessor does not handle ternary conditional expressions, it just expands them as is).
clang version 18.1.3 Ubuntu 24.04 Versions:
In a vanilla Zephyr workspace,
mkdir build && cd build
ZEPHYR_TOOLCHAIN_VARIANT=llvm cmake -GNinja -DBOARD=nrf5340bsim/nrf5340/cpuapp ../samples/hello_world/ -DCONFIG_NRFX_DPPI=y
The text was updated successfully, but these errors were encountered:
A quick fix would be
diff --git a/nrfx/drivers/nrfx_common.h b/nrfx/drivers/nrfx_common.h index 8d7a2a7..af27efd 100644 --- a/nrfx/drivers/nrfx_common.h +++ b/nrfx/drivers/nrfx_common.h @@ -136,7 +136,7 @@ extern "C" { * * @return Bit mask. */ -#define NRFX_BIT_MASK(x) (((x) == 32) ? UINT32_MAX : ((1UL << (x)) - 1)) +#define NRFX_BIT_MASK(x) (((x) == 32) ? UINT32_MAX : ((1ULL << (x)) - 1)) /** * @brief Macro for returning size in bits for given size in bytes.
Sorry, something went wrong.
No branches or pull requests
Building drivers/src/nrfx_dppi.c with clang for the nrf5340 results in the following warning:
Note, this is the expansion of this macro as it will be compiled:
(Note the preprocessor does not handle ternary conditional expressions, it just expands them as is).
Environment
clang version 18.1.3
Ubuntu 24.04
Versions:
Steps to reproduce
In a vanilla Zephyr workspace,
mkdir build && cd build
ZEPHYR_TOOLCHAIN_VARIANT=llvm cmake -GNinja -DBOARD=nrf5340bsim/nrf5340/cpuapp ../samples/hello_world/ -DCONFIG_NRFX_DPPI=y
The text was updated successfully, but these errors were encountered: