| View previous topic :: View next topic |
| Author |
Message |
benkirk
Joined: 21 Oct 2004 Posts: 2
|
Posted: Thu Apr 25, 2013 10:48 am Post subject: 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
| Code: |
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... |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Mon Apr 29, 2013 9:48 am Post subject: |
|
|
Hi benkrik,
"-w" or "-Minform=severe" disable warnings, but there is not a method to suppress a particular warning.
- Mat |
|
| Back to top |
|
 |
|