-
Notifications
You must be signed in to change notification settings - Fork 619
os/include: resolve build warnings #6585
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
Conversation
74180e9 to
dc1b25d
Compare
ritesh55555
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build warnings resolved
CookieDoughMixer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a work around. Is it possible that these errors are occuring because we include c headers in cpp files? Will it be possible to resolve them by adding extern C at appropriate places?
Yes, its work around The proper fix can be as follow:
But in our case, none of above will work. Can we change Reference - https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html |
@abhishek-samsung i think it is not because of cpp files. Also this is applied only for the few required lines which should not create a problem. |
I think this might be a better option. Please try it out. |
b3dddd6
dc1b25d to
b3dddd6
Compare
Issue: Getting below build warnings ``` include/signal.h:590:83: WARNING: 'int sigaction(int, const sigaction*, sigaction*)' hides constructor for 'struct sigaction' [-Wshadow] 590 | int sigaction(int sig, FAR const struct sigaction *act, FAR struct sigaction *oact); include/stdlib.h:603:30: WARNING: 'mallinfo mallinfo()' hides constructor for 'struct mallinfo' [-Wshadow] 603 | struct mallinfo mallinfo(void); ``` Cause: the struct `sigaction` and function `sigaction` is declared with same name. During compilation they were part of same namespace that's causing shadowing of struct with function declaration. Same is true for `mallinfo` Resolution: Disable shadow warning during function declaration and enable it after declaration. Note: GCC>=7 doesn't throw this error with -Wshadow flag. This temporary changes is only needed to support build with old version of GCC.
b3dddd6 to
0edb887
Compare
Issue: Getting below build warnings
Cause: the struct
sigactionand functionsigactionis declared with samename. During compilation they were part of same namespace that's
causing shadowing of struct with function declaration. Same is true for
mallinfoResolution: Disable shadow warning during function declaration and
enable it after declaration.
Note: GCC>=7 doesn't throw this error with -Wshadow flag. This
temporary changes is only needed to support build with old version of
GCC.