Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • dumux dumux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 104
    • Issues 104
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 90
    • Merge requests 90
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • dumux-repositoriesdumux-repositories
  • dumuxdumux
  • Issues
  • #1030
Closed
Open
Issue created May 14, 2021 by Christoph Grüninger@gruenichMaintainer

Two unreachable code sections

Clang 12 warns about two code section, which are not reachable. Often, this is a sign that the code behaves different from what the programmer expected. In other words, it could be a bug or it could be some overcautious code.
Do you mind having a look?

[ 30%] Building CXX object test/material/fluidsystems/CMakeFiles/test_fluidsystems.dir/test_fluidsystems.cc.o
In file included from /usr/include/c++/11/cassert:44,
                 from /home/gruenich/dune/complete/dune-common/dune/common/parallel/mpihelper.hh:7,
                 from /home/gruenich/dune/complete/dumux/dumux/common/parameters.hh:36,
                 from /home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh:31,
                 from /home/gruenich/dune/complete/dumux/test/material/fluidsystems/checkfluidsystem.hh:40,
                 from /home/gruenich/dune/complete/dumux/test/material/fluidsystems/test_fluidsystems.cc:28:
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh: In static member function ‘static constexpr int Dumux::FluidSystems::BrineCO2<Scalar, CO2Table, H2OType, Policy>::BrineAdapterPolicy::compIdx(int) [with Scalar = double; CO2Table = Dumux::HeterogeneousCO2Tables::CO2Tables; H2OType = Dumux::Components::SimpleH2O<double>; Policy = Dumux::FluidSystems::BrineCO2DefaultPolicy<false>]’:
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh:181:70: warning: statement will never be executed [-Wswitch-unreachable]
  181 |                 assert(brineCompIdx == VariableSalinityBrine::H2OIdx || brineCompIdx == VariableSalinityBrine::NaClIdx);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh: In static member function ‘static constexpr int Dumux::FluidSystems::BrineCO2<Scalar, CO2Table, H2OType, Policy>::BrineAdapterPolicy::compIdx(int) [with Scalar = double; CO2Table = Dumux::HeterogeneousCO2Tables::CO2Tables; H2OType = Dumux::Components::H2O<double>; Policy = Dumux::FluidSystems::BrineCO2DefaultPolicy<false>]’:
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh:181:70: warning: statement will never be executed [-Wswitch-unreachable]
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh: In static member function ‘static constexpr int Dumux::FluidSystems::BrineCO2<Scalar, CO2Table, H2OType, Policy>::BrineAdapterPolicy::compIdx(int) [with Scalar = double; CO2Table = Dumux::HeterogeneousCO2Tables::CO2Tables; H2OType = Dumux::Components::TabulatedComponent<Dumux::Components::H2O<double>, true>; Policy = Dumux::FluidSystems::BrineCO2DefaultPolicy<false>]’:
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh:181:70: warning: statement will never be executed [-Wswitch-unreachable]
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh: In static member function ‘static constexpr int Dumux::FluidSystems::BrineCO2<Scalar, CO2Table, H2OType, Policy>::BrineAdapterPolicy::compIdx(int) [with Scalar = double; CO2Table = Dumux::HeterogeneousCO2Tables::CO2Tables; H2OType = Dumux::Components::TabulatedComponent<Dumux::Components::H2O<double>, true>; Policy = Dumux::FluidSystems::BrineCO2DefaultPolicy<false, true>]’:
/home/gruenich/dune/complete/dumux/dumux/material/fluidsystems/brineco2.hh:181:70: warning: statement will never be executed [-Wswitch-unreachable]
[ 99%] Building CXX object examples/shallowwaterfriction/CMakeFiles/example_shallowwaterfriction.dir/main.cc.o
In file included from /home/gruenich/dune/complete/dumux/examples/biomineralization/material/fluidsystems/biominsimplechemistry.hh:62,
                 from /home/gruenich/dune/complete/dumux/examples/biomineralization/properties.hh:48,
                 from /home/gruenich/dune/complete/dumux/examples/biomineralization/main.cc:57:
/home/gruenich/dune/complete/dumux/examples/biomineralization/material/fluidsystems/biominsimplechemistry.hh: In static member function ‘static constexpr int Dumux::FluidSystems::BioMinSimpleChemistryFluid<Scalar, CO2Table, H2OType>::BrineAdapterPolicy::compIdx(int) [with Scalar = double; CO2Table = Dumux::ICP::CO2Tables; H2OType = Dumux::Components::TabulatedComponent<Dumux::Components::H2O<double>, true>]’:
/home/gruenich/dune/complete/dumux/examples/biomineralization/material/fluidsystems/biominsimplechemistry.hh:236:25: warning: statement will never be executed [-Wswitch-unreachable]
  233 |                 assert(brineCompIdx == Brine::H2OIdx
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  234 |                         || brineCompIdx == Brine::NaIdx
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  235 |                         || brineCompIdx == Brine::ClIdx
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  236 |                         || brineCompIdx == Brine::CaIdx
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assignee
Assign to
Time tracking