aboutsummaryrefslogtreecommitdiffstats
path: root/git-compat-util.h
diff options
context:
space:
mode:
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 6aee4d92e7..b90b64718e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -189,6 +189,13 @@ struct strbuf;
#define _NETBSD_SOURCE 1
#define _SGI_SOURCE 1
+#if defined(__GNUC__)
+#define UNUSED __attribute__((unused)) \
+ __attribute__((deprecated ("parameter declared as UNUSED")))
+#else
+#define UNUSED
+#endif
+
#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
# if !defined(_WIN32_WINNT)
# define _WIN32_WINNT 0x0600
@@ -261,6 +268,7 @@ static inline int is_xplatform_dir_sep(int c)
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <sys/statvfs.h>
#include <termios.h>
#ifndef NO_SYS_SELECT_H
#include <sys/select.h>
@@ -397,7 +405,9 @@ typedef uintmax_t timestamp_t;
#endif
#ifndef platform_core_config
-static inline int noop_core_config(const char *var, const char *value, void *cb)
+static inline int noop_core_config(const char *var UNUSED,
+ const char *value UNUSED,
+ void *cb UNUSED)
{
return 0;
}
@@ -490,7 +500,8 @@ static inline void extract_id_from_env(const char *env, uid_t *id)
}
}
-static inline int is_path_owned_by_current_uid(const char *path, struct strbuf *report)
+static inline int is_path_owned_by_current_uid(const char *path,
+ struct strbuf *report UNUSED)
{
struct stat st;
uid_t euid;
@@ -568,8 +579,11 @@ static inline int git_has_dir_sep(const char *path)
/* The sentinel attribute is valid from gcc version 4.0 */
#if defined(__GNUC__) && (__GNUC__ >= 4)
#define LAST_ARG_MUST_BE_NULL __attribute__((sentinel))
+/* warn_unused_result exists as of gcc 3.4.0, but be lazy and check 4.0 */
+#define RESULT_MUST_BE_USED __attribute__ ((warn_unused_result))
#else
#define LAST_ARG_MUST_BE_NULL
+#define RESULT_MUST_BE_USED
#endif
#define MAYBE_UNUSED __attribute__((__unused__))