cholla-hydro / cholla

A GPU-based hydro code
https://github.com/cholla-hydro/cholla/wiki
MIT License
60 stars 32 forks source link

Fix compiler warnings in MHD build #272

Closed bcaddy closed 1 year ago

bcaddy commented 1 year ago

The MHD builds have been throwing some "unused variable" and "format overflow" warnings pretty much since the start. I finally got too annoyed with them and set out to fix them.

I fixed most of the "unused variable" warnings by using an attribute specifier, which are new in C++17. You just add [[maybe_unused]] to the declaration of a variable if it might be unused.

One of the "unused variable" warnings was actually an unused variable so I removed it and refactored a bit to use some of the cuda_utilities functions we've written. I'd like @helenarichie to take a look at commit c8a828f to make sure I didn't break anything.

The "format overflow" errors were fixed by replacing char[] arrays with std::string.