Skip to content

module_interface.h: add forward struct comp_dev and timestamp_data - #7945

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
marc-hb:endpoint-forward-struct
Jul 14, 2023
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
marc-hb:endpoint-forward-struct

Conversation

@marc-hb

@marc-hb marc-hb commented Jul 14, 2023

Copy link
Copy Markdown
Collaborator

Fixes commit 9cc6454 ("module_adapter: Extend the module interface for endpoint devices")

As the endpoint_ops methods use only pointers to these two objects, it's not necessary to make their entire object structure visible. However a forward declaration is required to make them known to endpoint_ops users and fix the following warning:

error: 'struct comp_dev' declared inside parameter list will not be
visible outside of this definition or declaration [-Werror]

Fixes commit 9cc6454 ("module_adapter: Extend the module interface
for endpoint devices")

As the endpoint_ops methods use only pointers to these two objects, it's
not necessary to make their entire object structure visible. However a
forward declaration is required to make them known to endpoint_ops users
and fix the following warning:

```
error: 'struct comp_dev' declared inside parameter list will not be
visible outside of this definition or declaration [-Werror]
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb

marc-hb commented Jul 14, 2023 •

Copy link
Copy Markdown
Collaborator Author

It's still a mystery why Github Actions did not catch this in the original PR #7890 https://github.com/thesofproject/sof/actions/runs/5514181363/jobs/10053140087

Even weirder: it passed with the zephyr manifest in but not with the zephyr main branch in https://github.com/thesofproject/sof/actions/runs/5545805201/jobs/10125245211?pr=7932 for #7932?!? This misled me into wasting a bit of time with an irrelevant zephyr git bisect...

Sometimes PR A and PR B can both pass and not together but I don't see how this could have happened here Of course it depends on whether this .h file is actually used or not but how could it have been used before being merged?

EDIT: https://stackoverflow.com/questions/16831605/strange-compiler-warning-c-warning-struct-declared-inside-parameter-list has a good explanation.

@marc-hb
marc-hb marked this pull request as ready for review July 14, 2023 01:05
@marc-hb
marc-hb requested review from btian1 and ranj063 July 14, 2023 01:05

@btian1 btian1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

one question is: why CI does not report error before merge, and report error after merge?

line 70-71 add is needed, then how about below structure?

sof_ipc_stream_posn
sof_ipc_stream_params
input_stream_buffer
module_cfg_fragment_position

@marc-hb

marc-hb commented Jul 14, 2023 •

Copy link
Copy Markdown
Collaborator Author

one question is: why CI does not report error before merge, and report error after merge?

See the first comment. Will look into it.

then how about below structure?

sof_ipc_stream_posn
...

Simply because struct sof_ipc_stream_posn is already defined. For instance, this is how pipeline-stream.c gets sof/src/include/ipc/stream.h

In file included from sof/src/include/sof/audio/format.h:29,
                 from sof/src/include/sof/audio/audio_stream.h:17,
                 from sof/src/include/sof/audio/buffer.h:11,
                 from sof/src/audio/pipeline/pipeline-stream.c:8:

Other .c files get other .h files in other ways, otherwise the compiler would complain the same.

@marc-hb
marc-hb requested review from kv2019i and lyakh July 14, 2023 03:18
@marc-hb

marc-hb commented Jul 14, 2023 •

Copy link
Copy Markdown
Collaborator Author

All warnings fixed by this PR in https://github.com/thesofproject/sof/actions/runs/5549210444/jobs/10133047386?pr=7945

Today's daily builds failed consistently: MTL and LNL all failed whatever the Zephyr version is while the others never failed:
https://github.com/thesofproject/sof/actions/runs/5549292154/jobs/10133220677

};

struct comp_dev;
struct timestamp_data;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

actually this file also should include stdint.h and stdbool.h

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can be fixed incrementally.

@lyakh

lyakh commented Jul 14, 2023

Copy link
Copy Markdown
Collaborator

It's still a mystery why Github Actions did not catch this in the original PR #7890 https://github.com/thesofproject/sof/actions/runs/5514181363/jobs/10053140087

I think it worked originally because everywhere where this header was included originally also other headers were already available and now something changed somewhere - either the order of includes, or a new one was added without that accidental fix, or a header got removed somewhere.

@marc-hb

marc-hb commented Jul 14, 2023

Copy link
Copy Markdown
Collaborator Author

and now something changed somewhere - either the order of includes, or a new one was added without that accidental fix, or a header got removed somewhere.

... which means it could break again, so maybe @btian1 has a point?

Should we try to compile this .h file with a empty.c file and see what happens, would that help?

This looks very relevant:

@lgirdwood
lgirdwood merged commit 6ddf6c0 into thesofproject:main Jul 14, 2023
@lgirdwood

Copy link
Copy Markdown
Member

Will take this now as it fixes build with some configs, can be refined further if needed.

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