summaryrefslogtreecommitdiff
path: root/compat/fopen.c
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsayjones.plus.com>2017-05-08 20:45:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-26 03:33:55 (GMT)
commitb0a642ac4624740187212aecec62b35a2eab38cb (patch)
treeed2e8e8b6bafc6dd97beea232b3844e321397cb5 /compat/fopen.c
parentd2bbb7c2bcf6e77ebfcabf4e12110fe6d5c91de6 (diff)
downloadgit-b0a642ac4624740187212aecec62b35a2eab38cb.zip
git-b0a642ac4624740187212aecec62b35a2eab38cb.tar.gz
git-b0a642ac4624740187212aecec62b35a2eab38cb.tar.bz2
git_fopen: fix a sparse 'not declared' warning
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: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/fopen.c')
-rw-r--r--compat/fopen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compat/fopen.c b/compat/fopen.c
index b5ca142..107b3e8 100644
--- a/compat/fopen.c
+++ b/compat/fopen.c
@@ -1,14 +1,14 @@
/*
* The order of the following two lines is important.
*
- * FREAD_READS_DIRECTORIES is undefined before including git-compat-util.h
+ * SUPPRESS_FOPEN_REDEFINITION is defined before including git-compat-util.h
* to avoid the redefinition of fopen within git-compat-util.h. This is
* necessary since fopen is a macro on some platforms which may be set
* based on compiler options. For example, on AIX fopen is set to fopen64
* when _LARGE_FILES is defined. The previous technique of merely undefining
* fopen after including git-compat-util.h is inadequate in this case.
*/
-#undef FREAD_READS_DIRECTORIES
+#define SUPPRESS_FOPEN_REDEFINITION
#include "../git-compat-util.h"
FILE *git_fopen(const char *path, const char *mode)