More MINGW compatibility changes

(cherry picked from commit ec84b475)
7 jobs for master in 65 minutes and 38 seconds (queued for 1 second)
Status Job ID Name Coverage
  Test
passed #5926
Linux
clang-c++11

00:21:17

passed #5928
Linux
clang-c++98

00:17:05

passed #5931
Linux
cppcheck

00:00:31

passed #5925
Linux
gcc-c++11

00:04:32

passed #5927
Linux
gcc-c++98

00:04:25

passed #5929
Apple
macos-c++11

00:09:15

passed #5930
Apple
macos-c++98

00:08:30