Add GCC format attributes to print functions

Fix format problems found.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@888 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2010-10-09 08:27:09 +00:00
parent a5eb733975
commit a5cba745e5
3 changed files with 14 additions and 9 deletions

View File

@@ -297,7 +297,7 @@ ob_pci_encode_unit(int *idx)
case IO_SPACE: case IO_SPACE:
/* [n]i[t]DD,F,RR,NNNNNNNN */ /* [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 */ n ? "n" : "", /* relocatable */
t ? "t" : "", /* aliased */ t ? "t" : "", /* aliased */
dev, fn, reg, t ? lo & 0x03FF : lo); dev, fn, reg, t ? lo & 0x03FF : lo);
@@ -306,7 +306,7 @@ ob_pci_encode_unit(int *idx)
case MEMORY_SPACE_32: case MEMORY_SPACE_32:
/* [n]m[t][p]DD,F,RR,NNNNNNNN */ /* [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 */ n ? "n" : "", /* relocatable */
t ? "t" : "", /* aliased */ t ? "t" : "", /* aliased */
p ? "p" : "", /* prefetchable */ p ? "p" : "", /* prefetchable */
@@ -319,7 +319,7 @@ ob_pci_encode_unit(int *idx)
snprintf(buf, sizeof(buf), "%sx%s%x,%x,%x,%llx", snprintf(buf, sizeof(buf), "%sx%s%x,%x,%x,%llx",
n ? "n" : "", /* relocatable */ n ? "n" : "", /* relocatable */
p ? "p" : "", /* prefetchable */ p ? "p" : "", /* prefetchable */
dev, fn, reg, ((uint64_t)mid << 32) | (uint64_t)lo ); dev, fn, reg, ((long long)mid << 32) | (long long)lo);
break; break;
} }
push_str(buf); push_str(buf);

View File

@@ -524,7 +524,7 @@ hfs_files_dir( hfs_info_t *dummy )
forth_printf("\n"); forth_printf("\n");
while( !hfs_readdir(common->dir, &ent) ) { while( !hfs_readdir(common->dir, &ent) ) {
forth_printf("% 10d ", ent.u.file.dsize); forth_printf("% 10ld ", ent.u.file.dsize);
print_date(ent.mddate); print_date(ent.mddate);
if( ent.flags & HFS_ISDIR ) if( ent.flags & HFS_ISDIR )
forth_printf("%s\\\n", ent.name); forth_printf("%s\\\n", ent.name);

View File

@@ -20,11 +20,16 @@
#include <stdarg.h> #include <stdarg.h>
#include "config.h" #include "config.h"
extern int vsprintf(char *buf, const char *fmt, va_list args ); int vsprintf(char *buf, const char *fmt, va_list args)
extern int sprintf(char * buf, const char *fmt, ...); __attribute__((__format__(__printf__, 2, 0)));
extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); int sprintf(char * buf, const char *fmt, ...)
extern int snprintf(char * buf, size_t size, 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 */ #endif /* _H_VSPRINTF */