Re #8997. Removed macros. Changed c-style casts to static_casts
Re #8997. Fix gcc warnings
Merge remote-tracking branch 'origin/bugfix/8997_cppcheck_errors_in_instrumentwindow'