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

Fixes for some of the compile warnings (-Wall -pedantic). #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

folkertvanheusden
Copy link
Contributor

@folkertvanheusden folkertvanheusden commented Dec 9, 2023

This PR fixes some of the compile warnings.
examples/gadget-hid.c was just a matter of some casting, examples/gadget-vid-pid-remove.c was a bug, most others were stray ';'.

Two important things:

  • the test set complains about 10 failed tests before my changes and also (same) 10 after

  • I did not understand container_of and ARRAY_SIZE_SENTINEL

First container_of:

#define container_of(ptr, type, field) ({                               \
                        const typeof(((type *)0)->field) *member = (ptr); \
                        (type *)( (char *)member - offsetof(type, field) ); \
                })

member is assigned the contents of 'ptr' with a typeof but in the line after that, member is casted to char * anyway?

ARRAY_SIZE_SENTINEL: what is it for? It is instantiated 4 times but never referenced. Also it has the 'unused' attribute. So why bother? I disabled (not removed) it for now as compiling it produces warnings about 0-sized arrays.

@mgrzeschik
Copy link
Contributor

I took this partially . Could you rebase. Thanks!

@folkertvanheusden
Copy link
Contributor Author

folkertvanheusden commented Sep 25, 2024 via email

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.

2 participants