Skip to content
New issue

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

ipc4: handler: Add fallthrough comment to prevent compilation error #8228

Closed
wants to merge 1 commit into from

Conversation

ranj063
Copy link
Collaborator

@ranj063 ranj063 commented Sep 19, 2023

Add the fallthrough comment to prevent the error seen with shared library build:
"handler.c:312:20: error: this statement may fall through [-Werror=implicit-fallthrough=]"

Add the fallthrough comment to prevent the error seen with shared
library build:
"handler.c:312:20: error: this statement may fall through
[-Werror=implicit-fallthrough=]"

Signed-off-by: Ranjani Sridharan <[email protected]>
Copy link
Contributor

@btian1 btian1 left a comment

Choose a reason for hiding this comment

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

which build will show this error? I did not see it in my local build.

@@ -311,6 +311,7 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
case SOF_IPC4_PIPELINE_STATE_EOS:
if (status != COMP_STATE_ACTIVE)
return IPC4_INVALID_REQUEST;
/* fallthrough */
Copy link
Collaborator

Choose a reason for hiding this comment

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

COMPILER_FALLTHROUGH

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lyakh compiler_fallthrough doesn't seem to help with the host build with ipc4. What am I missing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, looking at the definition:

#if ((defined(__GNUC__) && (__GNUC__ >= 7)) || \
(defined(__clang__) && (__clang_major__ >= 10))) && !defined(__CHECKER__)
#define COMPILER_FALLTHROUGH __attribute__((fallthrough))
#else
#define COMPILER_FALLTHROUGH /* fallthrough */
#endif
- the only possibility I see for that not to work for you is if in your case the __attribute__((fallthrough)) definition is used, but that attribute isn't known to your compiler and it's ignoring an unknown attribute. Can you try -Wignored-attributes (note, that when building with sparse enabled, the -Wno-attributes option is used, which suppresses such warnings)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Zephyr has a universal "fallthrough" that we could copy/re-use #8383 (comment)

cc: @singalsu

@ranj063
Copy link
Collaborator Author

ranj063 commented Sep 27, 2023

pulled into #8232

@ranj063 ranj063 closed this Sep 27, 2023
@ranj063 ranj063 deleted the fix/handler_warning branch September 27, 2023 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants