Author: blueswirl Date: Sat Oct 9 10:27:09 2010 New Revision: 888 URL: http://tracker.coreboot.org/trac/openbios/changeset/888
Log: Add GCC format attributes to print functions
Fix format problems found.
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/drivers/pci.c trunk/openbios-devel/fs/hfs/hfs_fs.c trunk/openbios-devel/include/libc/vsprintf.h
Modified: trunk/openbios-devel/drivers/pci.c ============================================================================== --- trunk/openbios-devel/drivers/pci.c Tue Oct 5 10:52:49 2010 (r887) +++ trunk/openbios-devel/drivers/pci.c Sat Oct 9 10:27:09 2010 (r888) @@ -297,7 +297,7 @@ case IO_SPACE:
/* [n]i[t]DD,F,RR,NNNNNNNN */ - snprintf(buf, sizeof(buf), "%si%s%x,%x,%x,%x", + snprintf(buf, sizeof(buf), "%si%s%x,%x,%x," FMT_ucellx, n ? "n" : "", /* relocatable */ t ? "t" : "", /* aliased */ dev, fn, reg, t ? lo & 0x03FF : lo); @@ -306,7 +306,7 @@ case MEMORY_SPACE_32:
/* [n]m[t][p]DD,F,RR,NNNNNNNN */ - snprintf(buf, sizeof(buf), "%sm%s%s%x,%x,%x,%x", + snprintf(buf, sizeof(buf), "%sm%s%s%x,%x,%x," FMT_ucellx, n ? "n" : "", /* relocatable */ t ? "t" : "", /* aliased */ p ? "p" : "", /* prefetchable */ @@ -319,7 +319,7 @@ snprintf(buf, sizeof(buf), "%sx%s%x,%x,%x,%llx", n ? "n" : "", /* relocatable */ p ? "p" : "", /* prefetchable */ - dev, fn, reg, ((uint64_t)mid << 32) | (uint64_t)lo ); + dev, fn, reg, ((long long)mid << 32) | (long long)lo); break; } push_str(buf);
Modified: trunk/openbios-devel/fs/hfs/hfs_fs.c ============================================================================== --- trunk/openbios-devel/fs/hfs/hfs_fs.c Tue Oct 5 10:52:49 2010 (r887) +++ trunk/openbios-devel/fs/hfs/hfs_fs.c Sat Oct 9 10:27:09 2010 (r888) @@ -524,7 +524,7 @@
forth_printf("\n"); while( !hfs_readdir(common->dir, &ent) ) { - forth_printf("% 10d ", ent.u.file.dsize); + forth_printf("% 10ld ", ent.u.file.dsize); print_date(ent.mddate); if( ent.flags & HFS_ISDIR ) forth_printf("%s\\n", ent.name);
Modified: trunk/openbios-devel/include/libc/vsprintf.h ============================================================================== --- trunk/openbios-devel/include/libc/vsprintf.h Tue Oct 5 10:52:49 2010 (r887) +++ trunk/openbios-devel/include/libc/vsprintf.h Sat Oct 9 10:27:09 2010 (r888) @@ -20,11 +20,16 @@ #include <stdarg.h> #include "config.h"
-extern int vsprintf(char *buf, const char *fmt, va_list args ); -extern int sprintf(char * buf, const char *fmt, ...); -extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); -extern int snprintf(char * buf, size_t size, const char *fmt, ...); +int vsprintf(char *buf, const char *fmt, va_list args) + __attribute__((__format__(__printf__, 2, 0))); +int sprintf(char * buf, const char *fmt, ...) + __attribute__((__format__(__printf__, 2, 3))); +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) + __attribute__((__format__(__printf__, 3, 0))); +int snprintf(char * buf, size_t size, const char *fmt, ...) + __attribute__((__format__(__printf__, 3, 4)));
-extern int forth_printf( const char *fmt, ... ); +int forth_printf(const char *fmt, ...) + __attribute__((__format__(__printf__, 1, 2)));
#endif /* _H_VSPRINTF */