Skip to content

Conversation

titouanc
Copy link
Contributor

@titouanc titouanc commented Oct 10, 2025

In commit 5e83d22, all bit masking
operations in audio/midi.h were modified to use BIT_MASK(n) instead of
literal hexadecimal constants. However, masking a number with a BIT_MASK
promotes it to an unsigned long (while UMPs are packets of uint32_t aka
unsigned on most platforms). This results in annoying warnings from LOG_*
calls, such as:

warning: format '%lX' expects argument of type 'long unsigned int',
but argument 4 has type 'uint32_t' {aka 'unsigned int'}

There is no point in making these long integers, so let's revert the
bit masks as they were before, with literal hexadecimal values.

This should remove some CI annoyance:

In commit 5e83d22, all bit masking
operations in audio/midi.h were modified to use BIT_MASK(n) instead of
literal hexadecimal constants. However, masking a number with a BIT_MASK
promotes it to an unsigned long (while UMPs are packets of uint32_t aka
unsigned on most platforms). This results in annoying warnings from LOG_*
calls, such as:

    warning: format '%lX' expects argument of type 'long unsigned int',
    but argument 4 has type 'uint32_t' {aka 'unsigned int'}

There is no point in making these long integers, so let's revert the
bit masks as they were before, with literal hexadecimal values.

Signed-off-by: Titouan Christophe <[email protected]>
Copy link

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. LGTM.

That said, I wonder if BIT(), BIT_MASK() and GENMASK() should be changed to use U instead of UL qualifiers? @nashif, @kartben, would that make sense?

@etienne-lms etienne-lms added the Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. label Oct 10, 2025
@titouanc
Copy link
Contributor Author

I wonder if BIT(), BIT_MASK() and GENMASK() should be changed to use U instead of UL qualifiers

I'd expect this to introduce some breakages (similar to the one being fixed here) all over the tree. If engaging in such a refactor; it could make sense have a long variant like BITL(), BIT_MASKL() and GENMASKL() ?

@dleach02
Copy link
Member

Can we please expedite this one as it is blocking some of our PRs in CI
@jfischer-no

@cfriedt cfriedt merged commit 1d1bf21 into zephyrproject-rtos:main Oct 10, 2025
37 checks passed
@titouanc titouanc deleted the fix-midi-long branch October 10, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Audio area: Samples Samples area: USB Universal Serial Bus Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc.

Projects

None yet

7 participants