diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-12-02 11:58:25 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:05:25 -0700 |
| commit | 34c0cd11a43671d68d47c99a895fb68dd920f0a5 (patch) | |
| tree | 7fc7b062724aabf7236118e90ba60a66d1dc017b | |
| parent | b82a180b5fe4e6b240c68d6f75dff573a71467fc (diff) | |
| download | sparse-dev-34c0cd11a43671d68d47c99a895fb68dd920f0a5.tar.gz | |
Move declaration of "die()" to lib.h and check its format.
Fix the format errors this exposed.
| -rw-r--r-- | compat/mmap-blob.c | 4 | ||||
| -rw-r--r-- | lib.h | 13 | ||||
| -rw-r--r-- | token.h | 1 |
3 files changed, 9 insertions, 9 deletions
diff --git a/compat/mmap-blob.c b/compat/mmap-blob.c index 6ddcd84a..3626cc73 100644 --- a/compat/mmap-blob.c +++ b/compat/mmap-blob.c @@ -18,7 +18,7 @@ void *blob_alloc(unsigned long size) void *ptr; if (size & ~CHUNK) - die("internal error: bad allocation size (%d bytes)", size); + die("internal error: bad allocation size (%lu bytes)", size); ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr == MAP_FAILED) ptr = NULL; @@ -28,6 +28,6 @@ void *blob_alloc(unsigned long size) void blob_free(void *addr, unsigned long size) { if (!size || (size & ~CHUNK) || ((unsigned long) addr & 512)) - die("internal error: bad blob free (%d bytes at %p)", size, addr); + die("internal error: bad blob free (%lu bytes at %p)", size, addr); munmap(addr, size); } @@ -64,14 +64,15 @@ typedef struct pseudo *pseudo_t; struct token *skip_to(struct token *, int); struct token *expect(struct token *, int, const char *); #ifdef __GNUC__ -#define FORMAT_ATTR __attribute__ ((__format__ (__printf__, 2, 3))) +#define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1))) #else -#define FORMAT_ATTR +#define FORMAT_ATTR(pos) #endif -extern void info(struct position, const char *, ...) FORMAT_ATTR; -extern void warning(struct position, const char *, ...) FORMAT_ATTR; -extern void error(struct position, const char *, ...) FORMAT_ATTR; -extern void error_die(struct position, const char *, ...) FORMAT_ATTR; +extern void die(const char *, ...) FORMAT_ATTR(1); +extern void info(struct position, const char *, ...) FORMAT_ATTR(2); +extern void warning(struct position, const char *, ...) FORMAT_ATTR(2); +extern void error(struct position, const char *, ...) FORMAT_ATTR(2); +extern void error_die(struct position, const char *, ...) FORMAT_ATTR(2); #undef FORMAT_ATTR #define __DECLARE_ALLOCATOR(type, x) \ @@ -190,7 +190,6 @@ extern const char *show_token(const struct token *); extern struct token * tokenize(const char *, int, struct token *, const char **next_path); extern struct token * tokenize_buffer(unsigned char *, unsigned long, struct token *); -extern void die(const char *, ...); extern void show_identifier_stats(void); extern struct token *preprocess(struct token *); |
