diff options
| author | Andrew Klossner <andrew@cesa.opbu.xerox.com> | 2008-07-07 06:41:14 -0700 | 
|---|---|---|
| committer | Wolfgang Denk <wd@denx.de> | 2008-07-09 23:55:46 +0200 | 
| commit | dc4b0b38d4aadf08826f6c31270f1eecd27964fd (patch) | |
| tree | 54bcc5c3f6e5e25e94fb3baa445f4beb02c1a045 /include/common.h | |
| parent | a292d2265ef0463be4e7c4827a8a0dec556f0a88 (diff) | |
| download | olio-uboot-2014.01-dc4b0b38d4aadf08826f6c31270f1eecd27964fd.tar.xz olio-uboot-2014.01-dc4b0b38d4aadf08826f6c31270f1eecd27964fd.zip | |
Fix printf errors.
The compiler will help find mismatches between printf formats and
arguments if you let it.  This patch adds the necessary attributes to
declarations in include/common.h, then begins to correct the resulting
compiler warnings.  Some of these were bugs, e.g., "$d" instead of
"%d" and incorrect arguments.  Others were just annoying, like
int-long mismatches on a system where both are 32 bits.  It's worth
fixing the annoying errors to catch the real ones.
Signed-off-by: Andrew Klossner <andrew@cesa.opbu.xerox.com>
Diffstat (limited to 'include/common.h')
| -rw-r--r-- | include/common.h | 15 | 
1 files changed, 10 insertions, 5 deletions
| diff --git a/include/common.h b/include/common.h index 10b997e9e..2fcb1fd37 100644 --- a/include/common.h +++ b/include/common.h @@ -607,8 +607,10 @@ ulong	simple_strtoul(const char *cp,char **endp,unsigned int base);  unsigned long long	simple_strtoull(const char *cp,char **endp,unsigned int base);  #endif  long	simple_strtol(const char *cp,char **endp,unsigned int base); -void	panic(const char *fmt, ...); -int	sprintf(char * buf, const char *fmt, ...); +void	panic(const char *fmt, ...) +		__attribute__ ((format (__printf__, 1, 2))); +int	sprintf(char * buf, const char *fmt, ...) +		__attribute__ ((format (__printf__, 2, 3)));  int	vsprintf(char *buf, const char *fmt, va_list args);  /* lib_generic/crc32.c */ @@ -630,7 +632,8 @@ int	disable_ctrlc (int);	/* 1 to disable, 0 to enable Control-C detect */   */  /* serial stuff */ -void	serial_printf (const char *fmt, ...); +void	serial_printf (const char *fmt, ...) +		__attribute__ ((format (__printf__, 1, 2)));  /* stdin */  int	getc(void); @@ -639,7 +642,8 @@ int	tstc(void);  /* stdout */  void	putc(const char c);  void	puts(const char *s); -void	printf(const char *fmt, ...); +void	printf(const char *fmt, ...) +		__attribute__ ((format (__printf__, 1, 2)));  void	vprintf(const char *fmt, va_list args);  /* stderr */ @@ -656,7 +660,8 @@ void	vprintf(const char *fmt, va_list args);  #define stderr		2  #define MAX_FILES	3 -void	fprintf(int file, const char *fmt, ...); +void	fprintf(int file, const char *fmt, ...) +		__attribute__ ((format (__printf__, 2, 3)));  void	fputs(int file, const char *s);  void	fputc(int file, const char c);  int	ftstc(int file); |