cholla-hydro / cholla

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

Fix 7 `bugprone` clang-tidy checks #267

Closed bcaddy closed 1 year ago

bcaddy commented 1 year ago

bugprone-assignment-in-if-condition 15daaa6

Remove assignments from inside if statements. They only popped up in src/mpi/mpi_routines.cpp and I've confirmed with equivalent code that the new method works but I would still like @evaneschneider to take a look.

bugprone-branch-clone 07578c4

Remove duplicate branches in branching statements

bugprone-integer-division 88ab9f5

This was fixed by explicitly casting to int or Real. I think the change in src/particles/feedback_CIC_gpu.cu fixes a bug. I believe that previously the statement always evaluated to zero if the ints were positive. I'd like @ojwg to confirm that it wasn't intended behavior.

bugprone-string-integer-assignment 7c8a782

Replace implicit conversions with std::to_string.

bugprone-macro-parentheses 5bf1c09

Add parentheses to macros to make them more explicit.

bugprone-reserved-identifier 1577fbc

Started working with no changes required. Likely original errors were in headers

bugprone-easily-swappable-parameters 7d6e3ac

Permanently disabled. This checks for contiguous arguments with the same type which we will always have many of and refactoring around this would be time consuming with no real benefit.

bcaddy commented 1 year ago

I believe this is ready to go. @ojwg has approved the changes I was most concerned about.