Skip to content

Fix warnings from new compilers#1291

Merged
bcoconni merged 12 commits intoJSBSim-Team:masterfrom
heshpdx:master
Jun 4, 2025
Merged

Fix warnings from new compilers#1291
bcoconni merged 12 commits intoJSBSim-Team:masterfrom
heshpdx:master

Conversation

@heshpdx
Copy link
Contributor

@heshpdx heshpdx commented May 27, 2025

Latest compilers uncovered some warnings, mostly regarding mismatched virtual function signatures.

type of 'ptm' does not match original declaration [-Wlto-type-mismatch] 
'virtual bool JSBSim::FGModel::Load(JSBSim::Element*)' was hidden [-Woverloaded-virtual=]
'virtual double JSBSim::FGEngine::GetPowerAvailable()' was hidden [-Woverloaded-virtual=]
'virtual double JSBSim::FGThruster::GetPowerRequired()' was hidden [-Woverloaded-virtual=]
cast between incompatible pointer to member types from 'const JSBSim::FGColumnVector3& (JSBSim::FGAccelerations::*)() const' to 'PMF' {aka 'double (JSBSim::FGAccelerations::*)(int) const'} [-Wcast-function-type]

Found using
gcc-15.1.0 -pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-unused-label -Wno-misleading-indentation -Wno-parentheses -Wno-implicit-fallthrough
#834

type of 'ptm' does not match original declaration [-Wlto-type-mismatch]
'virtual bool JSBSim::FGModel::Load(JSBSim::Element*)' was hidden [-Woverloaded-virtual=]
'virtual double JSBSim::FGEngine::GetPowerAvailable()' was hidden [-Woverloaded-virtual=]
'virtual double JSBSim::FGThruster::GetPowerRequired()' was hidden [-Woverloaded-virtual=]
@codecov
Copy link

codecov bot commented May 27, 2025

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Project coverage is 24.76%. Comparing base (024046d) to head (80632ed).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/initialization/FGTrimAxis.cpp 0.00% 1 Missing ⚠️
src/models/FGOutput.h 0.00% 1 Missing ⚠️
src/models/propulsion/FGBrushLessDCMotor.h 0.00% 1 Missing ⚠️
src/models/propulsion/FGElectric.h 0.00% 1 Missing ⚠️
src/models/propulsion/FGEngine.h 0.00% 1 Missing ⚠️
src/models/propulsion/FGRotor.h 0.00% 1 Missing ⚠️
src/models/propulsion/FGTurbine.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1291   +/-   ##
=======================================
  Coverage   24.76%   24.76%           
=======================================
  Files         169      169           
  Lines       19598    19605    +7     
=======================================
+ Hits         4854     4856    +2     
- Misses      14744    14749    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@heshpdx heshpdx changed the title Fix warnings from new compilers DRAFT: Fix warnings from new compilers May 28, 2025
@heshpdx
Copy link
Contributor Author

heshpdx commented May 28, 2025

This isn't the full fix. WIP...

Copy link
Member

@bcoconni bcoconni left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR @heshpdx.

I have made a couple of suggestions about how the code from JSBSim should be modified to silence the warnings. Please review them and let us know about your feedback.

@bcoconni
Copy link
Member

This isn't the full fix. WIP...

No problem! Please take into account the comments I have made above (especially about using C++'s using rather than moving methods up in the class hierarchy) before submitting an update

heshpdx and others added 4 commits May 31, 2025 17:24
Co-authored-by: Bertrand Coconnier <bcoconni@users.noreply.github.com>
warning: cast between incompatible pointer to member types from 'const JSBSim::FGColumnVector3& (JSBSim::FGAccelerations::*)() const' to 'PMF' {aka 'double (JSBSim::FGAccelerations::*)(int) const'} [-Wcast-function-type]
Copy link
Member

@bcoconni bcoconni left a comment

Choose a reason for hiding this comment

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

While we are modifying code to fix warnings, we could take this opportunity to fix some old-fashioned code and use C++11's nullptr instead of 0.

heshpdx and others added 3 commits June 1, 2025 18:06
Replace 0 with nullptr

Co-authored-by: Bertrand Coconnier <bcoconni@users.noreply.github.com>
@heshpdx heshpdx changed the title DRAFT: Fix warnings from new compilers Fix warnings from new compilers Jun 1, 2025
@heshpdx heshpdx requested a review from bcoconni June 1, 2025 18:14
Copy link
Member

@bcoconni bcoconni left a comment

Choose a reason for hiding this comment

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

Looks good to me.
What about you @seanmcleod70 ?

@seanmcleod70
Copy link
Contributor

Yep, looks good to merge.

@bcoconni bcoconni merged commit 1f7bceb into JSBSim-Team:master Jun 4, 2025
29 checks passed
@bcoconni
Copy link
Member

bcoconni commented Jun 4, 2025

PR merged. Thanks for your contribution.

bcoconni pushed a commit to bcoconni/jsbsim that referenced this pull request Jun 7, 2025
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