Disable unreachable warnings?

Is it possible to disable unreachable code warnings?

Sometimes they are necessary, and being overwhelmed with unnecessary warnings masks the important stuff. Consider

inline
unsigned int Elem::which_child_am_i (const Elem* e) const
{
  for (unsigned int c=0; c<this->n_children(); c++)
    if (this->child(c) == e)
      return c;

  libMesh::err << "ERROR:  which_child_am_i() was called with a non-child!"
	        << std::endl;

  libmesh_error();

  return libMesh::invalid_uint;
}

I get a warnign that the last line is unreachable because libmesh_error(); invokes an abort. Yes, it is unreachable, but also necessary since the function has to return something. I looked at the man page and couldn’t easily find an option to suppress such warnings…

Hi benkrik,

“-w” or “-Minform=severe” disable warnings, but there is not a method to suppress a particular warning.

  • Mat