Join GitHub today
BUILD: Reduce GCC warnings #1471
This is not intended for immediate merge, but as a starting point for further discussion. ScummVM currently produces a lot of warnings when compiling with GCC 8. Possibly earlier versions as well. It would be good to silence the unnecessary compiler warnings, because the real warnings can easily be missed in the noise.
Most of the warnings, at the time I forked, were on the form "void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘...’; use assignment or value-initialization instead [-Wclass-memaccess]", so that's what I've focused on. The main method I've used is adding reset() methods to a number of classes and calling that instead. Is that a good approach? It seems a bit error-prone, since the method has to be updated if further members are added to the class or struct. And of course, I may have accidentally missed some as well.
There are still a couple of warnings remaining. Some of them looked non-trivial, and some were about memcpy() instead of memset(). In some cases, I didn't feel comfortable messing with that particular part of the code at the time.
The commits with fixes to BACKENDS, FULLPIPE and AGOS look correct and reasonably trivial... The SCUMM and AGI engine changes are slightly more involved and probably should be reviewed in detail, including the AGI change maybe needing further changes as per @eriktorbjorn 's comment.