Skip to content
  • Ramsay Jones's avatar
    git_fopen: fix a sparse 'not declared' warning · b0a642ac
    Ramsay Jones authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    If git is built with the FREAD_READS_DIRECTORIES build variable set, this
    would cause sparse to issue a 'not declared, should it be static?' warning
    on Linux. This is a result of the method employed by 'compat/fopen.c' to
    suppress the (possible) redefinition of the (system) fopen macro, which
    also removes the extern declaration of the git_fopen function.
    
    In order to suppress the warning, introduce a new macro to suppress the
    definition (or possibly the re-definition) of the fopen symbol as a macro
    override. This new macro (SUPPRESS_FOPEN_REDEFINITION) is only defined in
    'compat/fopen.c', just prior to the inclusion of the 'git-compat-util.h'
    header file.
    
    Signed-off-by: default avatarRamsay Jones <ramsay@ramsayjones.plus.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    b0a642ac