Skip to content

Conversation

@dbaluta
Copy link
Collaborator

@dbaluta dbaluta commented Jan 10, 2024

Guard sink_list in order to avoid the following variable unused warning:

$ sof/src/audio/dai-zephyr.c: In function 'dai_dma_cb': $ sof_dir/sof/src/audio/dai-zephyr.c:259:35: warning: unused variable 'sink_list' [-Wunused-variable]
259 | struct list_item *sink_list;
| ^~~~~~~~~

Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

Why not just use a better C99 declaration and move it right after the already existing #if CONFIG_IPC_MAJOR_4? We're in 2024 now...

C89 declarations are ugly and the #ifdef makes it even uglier.

In case you're wondering: we have C99 declarations in plenty other places and they never caused any issue with any toolchain. This topic was discussed in

} else {
#if CONFIG_IPC_MAJOR_4
struct list_item *sink_list;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

echo Marc, please move line 259 after line 270, this will make code looks more integrity.

@kv2019i
Copy link
Collaborator

kv2019i commented Jan 12, 2024

@dbaluta can you check, fix is good, but moving the declaration down avoids adding an ifdef...

Move sink_list under CONFIG_IPC_MAJOR_4 in order to avoid the following variable unused warning:

$ sof/src/audio/dai-zephyr.c: In function 'dai_dma_cb':
$ sof_dir/sof/src/audio/dai-zephyr.c:259:35: warning: unused variable 'sink_list' [-Wunused-variable]
  259 |                 struct list_item *sink_list;
      |                                   ^~~~~~~~~

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
@dbaluta
Copy link
Collaborator Author

dbaluta commented Jan 15, 2024

@dbaluta can you check, fix is good, but moving the declaration down avoids adding an ifdef...

done.

@dbaluta dbaluta merged commit c4bfdc6 into thesofproject:main Jan 15, 2024
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.

7 participants