diff options
author | Russ Allbery <rra@stanford.edu> | 2010-08-25 18:01:37 -0700 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2010-08-25 18:01:37 -0700 |
commit | 5cc66fdef38a67e25850159c0c5282d6dc927178 (patch) | |
tree | 9636351ee75eacc2f74a989fd8fad712fe95e6ec /tests/portable | |
parent | d46528a011f58881af9e9fb0c11de6422d469f17 (diff) | |
parent | e91c0b93355b28617f7c0d756026856762ece242 (diff) |
Merge commit 'upstream/0.12' into debian
Diffstat (limited to 'tests/portable')
-rw-r--r-- | tests/portable/snprintf-t.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/portable/snprintf-t.c b/tests/portable/snprintf-t.c index ca6ae61..fd4c228 100644 --- a/tests/portable/snprintf-t.c +++ b/tests/portable/snprintf-t.c @@ -2,7 +2,7 @@ * snprintf test suite. * * Written by Russ Allbery <rra@stanford.edu> - * Copyright 2009 Board of Trustees, Leland Stanford Jr. University + * Copyright 2009, 2010 Board of Trustees, Leland Stanford Jr. University * Copyright (c) 2004, 2005, 2006 * by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, @@ -17,6 +17,12 @@ #include <tests/tap/basic.h> /* + * Disable the requirement that format strings be literals. We need variable + * formats for easy testing. + */ +#pragma GCC diagnostic ignored "-Wformat-nonliteral" + +/* * Intentionally don't add the printf attribute here since we pass a * zero-length printf format during testing and don't want warnings. */ @@ -86,7 +92,7 @@ static unsigned long long ullong_nums[] = { static void -test_format(bool truncate, const char *expected, int count, +test_format(bool trunc, const char *expected, int count, const char *format, ...) { char buf[128]; @@ -94,7 +100,7 @@ test_format(bool truncate, const char *expected, int count, va_list args; va_start(args, format); - result = test_vsnprintf(buf, truncate ? 32 : sizeof(buf), format, args); + result = test_vsnprintf(buf, trunc ? 32 : sizeof(buf), format, args); va_end(args); is_string(expected, buf, "format %s, wanted %s", format, expected); is_int(count, result, "...and output length correct"); |