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 "catching polymorphic type" GCC 8 warnings #685

Merged
merged 1 commit into from
Aug 10, 2019

Conversation

band-a-prend
Copy link
Contributor

The "catching polymorphic type" warnings appear during compilation with GCC 8:

src/base/global.cpp: In function ‘void Cantera::setLogger(Cantera::Logger*)’:
src/base/global.cpp:28:19: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
     } catch (std::bad_alloc) {
                   ^~~~~~~~~
src/equil/vcs_MultiPhaseEquil.cpp: In member function ‘int Cantera::vcs_MultiPhaseEquil::equilibrate_HP(doublereal, int, double, double, int, int, doublereal, int, int)’:
src/equil/vcs_MultiPhaseEquil.cpp:228:31: warning: catching polymorphic type ‘class Cantera::CanteraError’ by value [-Wcatch-value=]
         } catch (CanteraError err) {
                               ^~~
src/equil/vcs_MultiPhaseEquil.cpp: In member function ‘int Cantera::vcs_MultiPhaseEquil::equilibrate_SP(doublereal, double, double, int, int, doublereal, int, int)’:
src/equil/vcs_MultiPhaseEquil.cpp:354:31: warning: catching polymorphic type ‘class Cantera::CanteraError’ by value [-Wcatch-value=]
         } catch (CanteraError err) {
                               ^~~

Changes proposed in this pull request:

  • This commit fix "catching polymorphic type" warnings via caught by reference.

@codecov
Copy link

codecov bot commented Aug 9, 2019

Codecov Report

Merging #685 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #685      +/-   ##
==========================================
+ Coverage   70.63%   70.63%   +<.01%     
==========================================
  Files         372      372              
  Lines       43567    43567              
==========================================
+ Hits        30772    30773       +1     
+ Misses      12795    12794       -1
Impacted Files Coverage Δ
src/base/global.cpp 75% <0%> (ø) ⬆️
src/equil/vcs_MultiPhaseEquil.cpp 60.67% <0%> (ø) ⬆️
src/transport/GasTransport.cpp 90.58% <0%> (+0.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1606ce1...90e3aac. Read the comment docs.

Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Patch looks fine to me. Can you remove the "cantera: " prefix from the commit message?

The "catching polymorphic type" warnings appear during compilation with GCC 8:

src/base/global.cpp: In function ‘void Cantera::setLogger(Cantera::Logger*)’:
src/base/global.cpp:28:19: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
     } catch (std::bad_alloc) {
                   ^~~~~~~~~

src/equil/vcs_MultiPhaseEquil.cpp: In member function ‘int Cantera::vcs_MultiPhaseEquil::equilibrate_HP(doublereal, int, double, double, int, int, doublereal, int, int)’:
src/equil/vcs_MultiPhaseEquil.cpp:228:31: warning: catching polymorphic type ‘class Cantera::CanteraError’ by value [-Wcatch-value=]
         } catch (CanteraError err) {
                               ^~~

src/equil/vcs_MultiPhaseEquil.cpp: In member function ‘int Cantera::vcs_MultiPhaseEquil::equilibrate_SP(doublereal, double, double, int, int, doublereal, int, int)’:
src/equil/vcs_MultiPhaseEquil.cpp:354:31: warning: catching polymorphic type ‘class Cantera::CanteraError’ by value [-Wcatch-value=]
         } catch (CanteraError err) {
                               ^~~

This commit fix this warnings via caught by reference.
@band-a-prend
Copy link
Contributor Author

@speth
mentioned prefix is removed.

@speth speth merged commit 5184ebc into Cantera:master Aug 10, 2019
@band-a-prend band-a-prend deleted the warnings branch September 27, 2020 00:28
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.

2 participants