Old Compiler Warning Cleanup (GCC 4.0.2)

1. Removed pragma disabling the warning for non-literal format strings
on `printf()`.
2. Switched the `printf()` into two printf calls.
This commit is contained in:
John Safranek 2022-01-14 17:11:55 -08:00
parent 153b9abc31
commit 2085624a29
No known key found for this signature in database
GPG Key ID: 8CE817DE0D3CCB4A
1 changed files with 35 additions and 32 deletions

View File

@ -1563,41 +1563,47 @@ static void* server_thread(void* args)
#endif /* !NO_WOLFSSL_SERVER */
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
static void print_stats(stats_t* wcStat, const char* desc, const char* cipher, const char *group, int verbose)
{
const char* formatStr;
if (verbose) {
formatStr = "wolfSSL %s Benchmark on %s with group %s:\n"
"\tTotal : %9d bytes\n"
"\tNum Conns : %9d\n"
"\tRx Total : %9.3f ms\n"
"\tTx Total : %9.3f ms\n"
"\tRx : %9.3f MB/s\n"
"\tTx : %9.3f MB/s\n"
"\tConnect : %9.3f ms\n"
"\tConnect Avg : %9.3f ms\n";
fprintf(stderr,
"wolfSSL %s Benchmark on %s with group %s:\n"
"\tTotal : %9d bytes\n"
"\tNum Conns : %9d\n"
"\tRx Total : %9.3f ms\n"
"\tTx Total : %9.3f ms\n"
"\tRx : %9.3f MB/s\n"
"\tTx : %9.3f MB/s\n"
"\tConnect : %9.3f ms\n"
"\tConnect Avg : %9.3f ms\n",
desc,
cipher,
group,
wcStat->txTotal + wcStat->rxTotal,
wcStat->connCount,
wcStat->rxTime * 1000,
wcStat->txTime * 1000,
wcStat->rxTotal / wcStat->rxTime / 1024 / 1024,
wcStat->txTotal / wcStat->txTime / 1024 / 1024,
wcStat->connTime * 1000,
wcStat->connTime * 1000 / wcStat->connCount);
}
else {
formatStr = "%-6s %-33s %-25s %11d %9d %9.3f %9.3f %9.3f %9.3f %17.3f %15.3f\n";
fprintf(stderr,
"%-6s %-33s %-25s %11d %9d %9.3f %9.3f %9.3f "
"%9.3f %17.3f %15.3f\n",
desc,
cipher,
group,
wcStat->txTotal + wcStat->rxTotal,
wcStat->connCount,
wcStat->rxTime * 1000,
wcStat->txTime * 1000,
wcStat->rxTotal / wcStat->rxTime / 1024 / 1024,
wcStat->txTotal / wcStat->txTime / 1024 / 1024,
wcStat->connTime * 1000,
wcStat->connTime * 1000 / wcStat->connCount);
}
fprintf(stderr, formatStr,
desc,
cipher,
group,
wcStat->txTotal + wcStat->rxTotal,
wcStat->connCount,
wcStat->rxTime * 1000,
wcStat->txTime * 1000,
wcStat->rxTotal / wcStat->rxTime / 1024 / 1024,
wcStat->txTotal / wcStat->txTime / 1024 / 1024,
wcStat->connTime * 1000,
wcStat->connTime * 1000 / wcStat->connCount);
}
static void Usage(void)
@ -1699,9 +1705,6 @@ static int SetupSupportedGroups(int verbose)
}
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
int bench_tls(void* args)
{