libmesh icon indicating copy to clipboard operation
libmesh copied to clipboard

Fix -Wimplicit-fallthrough warnings in libHilbert

Open jwpeterson opened this issue 5 years ago • 4 comments

The libHilbert code has thousands of the following warnings:

../../../../contrib/libHilbert/include/Hilbert/SetLocation.hpp:51:81: warning: this statement may fall through [-Wimplicit-fallthrough=]
 #define SETBIT p->racks()[ir]|=im; if ((*lr&jm)==0) p->racks()[ir]^=im; jm<<=1; ++p;
                                                                                 ^
../../../../contrib/libHilbert/include/Hilbert/SetLocation.hpp:53:15: note: in expansion of macro ‘SETBIT’
   case (a+1): SETBIT;
               ^~~~~~

it would be good to ignore these somehow.

jwpeterson avatar Oct 06 '20 19:10 jwpeterson

Are these coming from the build of libHilbert itself, or from a hilbert.h include that I forgot to wrap ignore_warnings.h around (I see src/mesh/mesh_communication_global_indices.C and include/parallel/parallel_conversion_utils.h missing them...), or is ignore_warnings.h failing to squelch -Wimplicit-fallthrough?

roystgnr avatar Oct 06 '20 19:10 roystgnr

I think it was while building libHilbert in contrib, but it has since scrolled way off my screen in the process of testing "make distcheck" so I'm only 90% sure.

jwpeterson avatar Oct 06 '20 19:10 jwpeterson

Even setting aside the fallthrough warnings, this macro needs to be wrapped in a do {} while (0) anyway...

jwpeterson avatar Oct 06 '20 20:10 jwpeterson

Looks like libHilbert maintainance stopped around 2014 (right when we contacted Chris to get permission to relicense under LGPL, whew!), and all I can find online today is a github archive copy from 2017, so I guess synchronizing with upstream isn't a problem or an opportunity here, in which case I'd totally be happy to see these sorts of code smells actually fixed rather than just hidden by pragmas.

roystgnr avatar Oct 06 '20 21:10 roystgnr