enable gcc to check arguments of printf-like functions
Check printf-like functions like conoutf, if format strings and argument lists match. This commit also fixes a lot of code parts that actually had mismatching argument lists - or did things, that this check does not like. numtime() was rewritten in an ugly but very portable fashion (it's recommended to stay away from "long long" format entries, because errors usually only come up at runtime). (some code was copied from sauer)
This commit is contained in:
@@ -20,8 +20,10 @@ const char *asctime()
|
||||
const char *numtime()
|
||||
{
|
||||
static string numt;
|
||||
formatstring(numt)("%ld", (long long) time(NULL));
|
||||
return numt;
|
||||
time_t t = time(NULL);
|
||||
int t1 = t / 1000000, t2 = t % 1000000;
|
||||
formatstring(numt)("%d%06d", t1, t2);
|
||||
return numt + strspn(numt, "0");
|
||||
}
|
||||
|
||||
static const uchar transformenttab[] = {
|
||||
|
||||
Reference in New Issue
Block a user