Skip to content
  • Max Horn's avatar
    fix clang -Wunused-value warnings for error functions · 5ded807f
    Max Horn authored and Junio C Hamano's avatar Junio C Hamano committed
    Commit a469a101
    
     wraps some error calls in macros to give the
    compiler a chance to do more static analysis on their
    constant -1 return value.  We limit the use of these macros
    to __GNUC__, since gcc is the primary beneficiary of the new
    information, and because we use GNU features for handling
    variadic macros.
    
    However, clang also defines __GNUC__, but generates warnings
    with -Wunused-value when these macros are used in a void
    context, because the constant "-1" ends up being useless.
    Gcc does not complain about this case (though it is unclear
    if it is because it is smart enough to see what we are
    doing, or too dumb to realize that the -1 is unused).  We
    can squelch the warning by just disabling these macros when
    clang is in use.
    
    Signed-off-by: default avatarMax Horn <max@quendi.de>
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    5ded807f