• J
    inline constant return from error() function · 87fe5df3
    Jeff King 提交于
    Commit e208f9cc introduced a macro to turn error() calls
    into:
    
      (error(), -1)
    
    to make the constant return value more visible to the
    calling code (and thus let the compiler make better
    decisions about the code).
    
    This works well for code like:
    
      return error(...);
    
    but the "-1" is superfluous in code that just calls error()
    without caring about the return value. In older versions of
    gcc, that was fine, but gcc 4.9 complains with -Wunused-value.
    
    We can work around this by encapsulating the constant return
    value in a static inline function, as gcc specifically
    avoids complaining about unused function returns unless the
    function has been specifically marked with the
    warn_unused_result attribute.
    
    We also use the same trick for config_error_nonbool and
    opterror, which learned the same error technique in a469a101.
    Reported-by: NFelipe Contreras <felipe.contreras@gmail.com>
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    87fe5df3
parse-options.h 9.0 KB