explicitly add compiler warnings when functions are not checked
In the following commit I have made an attempt to mark functions 'must_check', 'dont_check' and because it is many work to get everything right in one go: 'should_chk'.
https://github.com/cherokee/webserver/blob/ac612d718e3b6d55223696ef54375215fe66c577/cherokee/buffer.h
I wonder what you think about it from a technical point of view. My guess is that checking every chula_buffer_add_* operation might be a wasteful exercise. On the other hand, if realloc_inc_bufsize fails, and we continue, we end up in a failing cascade of functions which can result in a template engine producing garbage, including the scenario where are call 1 no memory is available but at call 2 there is.
I have mixed feelings. On the one hand, we should always check the return value of the functions. On the other though, making it mandatory looks to strict IMHO.
I guess virtue lies in the middle. We could add only the "should" and "must" entries in the cases they are actually necessary (or highly recommended).
Yes, I have mixed feelings about it as well. It is using this 'patch' not mandatory but will throw a warning in your face. I see good reasons for strictly checking everything, and I am personally interested if it has any significant impact with respect to performance or is transparent. Sadly it does result in code that is mixed with 'functions' and checking if each step of it worked out, which also makes me wonder if templated calls would theoretically be preferred of the now in use functions which add part of the strings along the way.
In any case, I didn't made up my mind what would be the best solution of a minimal problem: getting out of memory inside a webserver...