C compiler issues warnings on wrapper functions
My latest compiler (clang 12) complains about our wrapper codes.
As a frequent pattern, they generate code like this
int res;
if (cond) {
res = fun();
} else {
SAC_RuntimeError ( "type error.....");
}
return res;
The compiler complains about res
potentially not being initialised.
We have two options ere: either initialise res
with some dummy value, or declare SAC_RuntimeError
to be non-returning.
I would prefer the latter, but I am not sure how to do this in a platform (C compiler) - independent way. My clang compiler allows for:
_Noreturn void SAC_RuntimeError( ...);
This seems to be C++11 standard as well..... but I guess we may have to go through cmake to make this happen.