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

Warnings in py_wind_macro #144

Closed
kslong opened this issue Apr 17, 2015 · 4 comments
Closed

Warnings in py_wind_macro #144

kslong opened this issue Apr 17, 2015 · 4 comments
Labels

Comments

@kslong
Copy link
Collaborator

kslong commented Apr 17, 2015

My compile of py_wind is generating these warnings

py_wind_macro.c:471:7: warning: variable 'x' is used uninitialized whenever 'if' condition is
false [-Wsometimes-uninitialized]
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
py_wind_macro.c:486:12: note: uninitialized use occurs here
wmain[x->nwind].xcen[0], wmain[x->nwind].xcen[1],
^
py_wind_macro.c:471:3: note: remove the 'if' if its condition is always true
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
py_wind_macro.c:471:7: warning: variable 'x' is used uninitialized whenever '&&' condition is
false [-Wsometimes-uninitialized]
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~
py_wind_macro.c:486:12: note: uninitialized use occurs here
wmain[x->nwind].xcen[0], wmain[x->nwind].xcen[1],
^
py_wind_macro.c:471:7: note: remove the '&&' if its condition is always true
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~~~~
py_wind_macro.c:461:14: note: initialize the variable 'x' to silence this warning
PlasmaPtr x, xdummy;
^
= NULL
2 warnings generated.

They are all about uninitialized variables which would be easy to fix, by initializing things, but it is less clear to me (ksl) that these are not if statements where the logic has not been worked out completely or to check for error conditions.

@jhmatthews
Copy link
Collaborator

Try now @kslong - I added an error condition.

@kslong
Copy link
Collaborator Author

kslong commented Apr 20, 2015

I am still seeing these 2 warnings:

py_wind_macro.c:477:7: warning: variable 'x' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
py_wind_macro.c:492:12: note: uninitialized use occurs here
wmain[x->nwind].xcen[0], wmain[x->nwind].xcen[1],
^
py_wind_macro.c:477:3: note: remove the 'if' if its condition is always true
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
py_wind_macro.c:477:7: warning: variable 'x' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~
py_wind_macro.c:492:12: note: uninitialized use occurs here
wmain[x->nwind].xcen[0], wmain[x->nwind].xcen[1],
^
py_wind_macro.c:477:7: note: remove the '&&' if its condition is always true
if (icell >= 0 && icell < NDIM2)
^~~~~~~~~~~~~
py_wind_macro.c:467:14: note: initialize the variable 'x' to silence this warning
PlasmaPtr x, xdummy;
^
= NULL

@kslong
Copy link
Collaborator Author

kslong commented Apr 20, 2015

Apparently, James, you made some changes to fix this, but there were a couple of places where you used a python language construct instead of a c-language construct. I fixed these and it compiles now without errors on my machine. I've pushed this back to dev. Close if you agree.

@jhmatthews
Copy link
Collaborator

Woops...my automated build test caught this but it would appear having Knox on your team is just as effective! Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants