path: root/cache.h
diff options
authorTimo Sirainen <>2005-08-09 15:30:22 (GMT)
committerJunio C Hamano <>2005-08-10 05:28:19 (GMT)
commit4ec99bf080f2d95c7c3d706f65eea1c6b9302f23 (patch)
treed4645413f012a970eb7744004fe829aa2786a067 /cache.h
parent96ad15ae2ff6416cf04c4c75a11783632cdc8fb4 (diff)
[PATCH] -Werror fixes
GCC's format __attribute__ is good for checking errors, especially with -Wformat=2 parameter. This fixes most of the reported problems against 2005-08-09 snapshot.
Diffstat (limited to 'cache.h')
1 files changed, 8 insertions, 4 deletions
diff --git a/cache.h b/cache.h
index 957e2ca..efd2a2c 100644
--- a/cache.h
+++ b/cache.h
@@ -40,6 +40,10 @@
#define NORETURN
+#ifndef __attribute__
+#define __attribute(x)
* Intensive research over the course of many years has shown that
* port 9418 is totally unused by anything else. Or
@@ -171,8 +175,8 @@ extern void rollback_index_file(struct cache_file *);
#define TYPE_CHANGED 0x0040
/* Return a statically allocated filename matching the sha1 signature */
-extern char *mkpath(const char *fmt, ...);
-extern char *git_path(const char *fmt, ...);
+extern char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
extern char *sha1_file_name(const unsigned char *sha1);
extern char *sha1_pack_name(const unsigned char *sha1);
extern char *sha1_pack_index_name(const unsigned char *sha1);
@@ -218,8 +222,8 @@ extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
/* General helper functions */
extern void usage(const char *err) NORETURN;
-extern void die(const char *err, ...) NORETURN;
-extern int error(const char *err, ...);
+extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
+extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern int base_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
extern int cache_name_compare(const char *name1, int len1, const char *name2, int len2);