Jeff King <p...@peff.net> writes:
> So our attempt for more compile-time safety may actually introduce a
> run-time bug. And it is a hard bug to find, as the preprocessor
> "magically" converts the error code into -1 without you being able to
> see it in the code.
> It would be safer to just unconditionally use the macros and drop the
> return values from the functions entirely, like the patch below
> (squashed on top of what is in jk/error-const-return). But it cannot
> work for error(), because the variadic nature means we need to restrict
> ourselves to __GNUC__.
While I like the general direction, I am not sure if we are OK with
the introduction of
> #undef config_error_nonbool
> -int config_error_nonbool(const char *var)
> +void config_error_nonbool(const char *var)
> - return error("Missing value for '%s'", var);
> + error("Missing value for '%s'", var);
a new, arguably false, "returned value not used" warning from this
point. Perhaps it is fine for now, as we have tons of calls that do
not cast the return value to "(void)".
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html