-
Notifications
You must be signed in to change notification settings - Fork 166
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
Fix warnings [-Wunused-xxx] from compilation #879
base: master
Are you sure you want to change the base?
Fix warnings [-Wunused-xxx] from compilation #879
Conversation
63659f3
to
a59f016
Compare
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.
LGTM, thank you @cyrilgandon.
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.
Thanks for sharing
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.
Thank you @cyrilgandon for this PR. I have only one minor comment regarding Python procedures. Recently, a procedure of Python >3.9 (?) was introduced in the Fortran stdlib
, limiting its compilation on systems supporting most recent versions of Python. It would be nice if this issue can be avoided, hence my question below.
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.
Based on @perazz 's answer, this PR can be merged IMO. Thank you @cyrilgandon for cleaning the code.
I still have some fix to do on unused-dummy-argument. This is a bit more complicated because I have to really understand what the code does for some cases |
a59f016
to
b4d81fc
Compare
src/stdlib_str2num.fypp
Outdated
@@ -95,6 +95,7 @@ module stdlib_str2num | |||
integer(int8) :: p !! position within the number | |||
integer(int8) :: stat !! error status | |||
!---------------------------------------------- | |||
if (.false.) v = mold ! removes unused-dummy-argument warning |
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.
What does the compiler with this line? Does it remove it? What about the efficiency of adding this line of the whole procedure?
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.
I would refrain from such changes. In OO programming, variables defined in abstract routines of the base type can easily be unused in some inherited types. Adding some lines just to suppress the warning is artificial and error-prone. I would rather advocate an option in fpm to build without the argument -Wunused-XXX
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.
Fully second leaving the unused dummy arguments as they are. In this simple case the compiler will remove the line, but it is indeed error prone and artificial. Unless one is 100% sure that the procedures signature can be safely changed, then the best solution in this case is to don't do anything.
b4d81fc
to
f749a16
Compare
Cleaning duty, warnings are generates with
fpm build --verbose --flag '-Wunused-variable -Wunused-dummy-argument -Wunused-parameter'
Leaving 55 unused-dummy-argument warnings unresolvable, see conversation about those.