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

Fix some warnings #2682

Merged
merged 8 commits into from
Jul 21, 2020
Merged

Fix some warnings #2682

merged 8 commits into from
Jul 21, 2020

Conversation

rajat2004
Copy link
Contributor

@rajat2004 rajat2004 commented May 10, 2020

There are more warnings, many unused variables which can be seen when running the Unity build

Right now only testing till compilation

@@ -54,7 +54,7 @@ macro(CommonSetup)
else ()
set(CMAKE_CXX_FLAGS "\
-std=c++17 -ggdb -Wall -Wextra \
-Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused \
-Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -Wno-unknown-warning-option \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we remove the -Wno-unused flag here?

Copy link
Contributor

Choose a reason for hiding this comment

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

-Wno-unused is meant to ignore warnings involving unused variables, are you seeing those even with this flag on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the warnings are coming from the Unity build where it hasn't been disabled
I'm not sure if we should disable them or not, I haven't yet fixed all the warnings

@saihv
Copy link
Contributor

saihv commented May 10, 2020

I would advise against removing variables, especially in complex libraries like MavlinkCom - while they may be unused in that particular piece of code, they could have been meant to exist for the purpose of extensibility or some sort of parity.

If a variable has a purpose and is named appropriately it does not detract from the code as a whole. Warnings are a smaller problem, and I recommend we handle it through compiler flags. My two cents

@rajat2004
Copy link
Contributor Author

rajat2004 commented May 10, 2020

I agree, removing all the unused variables probably doesn't make much sense, that's why I haven't yet removed variables from places like AdaptiveController and some others in Mavlinkcom
Should I remove the commits for Mavlinkcom which are there right now?

@rajat2004
Copy link
Contributor Author

rajat2004 commented May 10, 2020

Once the warnings which should be ignored and fixed are decided, then will clean up the commits
Also, the Unity cmake needs to be looked at, there shouldn't be 2 sets of build flags, etc.

I'll go through the Mavlinkcom commits and only remove variables which seem harmless, or don't have any meaning currently

@rajat2004
Copy link
Contributor Author

I think I'll add back the other variables in Mavlinkcom but remove the ones commented above if others agree

@rajat2004
Copy link
Contributor Author

Commits cleaned up, only removed variables which didn't fit in the context

@rajat2004 rajat2004 force-pushed the warnings branch 2 times, most recently from 5e0ed2e to 5b4d524 Compare May 23, 2020 06:13

// Already have goal, and have reached it
ROS_INFO_STREAM("[PIDPositionController] Already have goal and have reached it");
return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is correct or not, we should probably set the goal in this case also

@madratman
Copy link
Contributor

/azp run microsoft.AirSim

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@madratman madratman merged commit c93eee5 into microsoft:master Jul 21, 2020
@rajat2004 rajat2004 deleted the warnings branch July 21, 2020 18:35
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.

3 participants