GCC 8 was recently released and introduced some new and improved warnings. The SAC code base currently triggers a few of these - specifically -Wcast-function-type
and -Wrestict
.
The first applies when a function cast is incompatible with the function pointer. We hit into this mainly in the serialise/de-serialise phase when loading functions from SAC tree files. The latter happens because of some unsafe uses of memory, which occurs when we use sprintf
in print/print.c
.
Most of the warnings have been reasonably resolved but some still remain.
The general problem is that we have some functions which return a function pointer, which may or may not have one argument defined as part of it type. In types/types.h
we specify a few function pointer types to encompasses these, but casting from one variant to the other causes the -Wcast-function-type
warning to be issued. I don't know how to resolve that effectively - at the moment I have bodged it by using some GCC #pragma
to disable to warning at that point. Any suggestions?