Improve error check at compilation time
I recently fixed a crash which was originated by a function expected to return a pointer and actually missing an explicit return in a specific code path instead of returning NULL.
IMHO this should enable compilation flags to at least have warning about this kind of error to avoid running into similar issues in the future (and we may actually find there are still similar issues nowadays).
It should at least print a warning message at compile time (-Wreturn-type ?), but I think the best would be to treat those cases as errors by default (-Werror), so that we keep the code clean and we then care about the issues printed by the compiler. Other kind of similar checks would be also welcome.
As far as I know, there's some part at least in osmo-iuh which is auto-generated and may print lots of warnings which we cannot fix. I guess in this case we can apply different CFLAGS to that specific set of files which is more relaxed to avoid lots of garbage warnings.
#1 Updated by pespin over 3 years ago
It seems some related work was already done in openbsc. Worth having a look and applying something similar: http://cgit.osmocom.org/openbsc/commit/?id=34f012639ddf41470714ae74ae961d158670a4c7