From 0ef1f9cd8c7a799a91b7d9ac776a4a8d3adaefa5 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 16 Jan 2017 18:08:45 +0000 Subject: [PATCH] Fix testcases for PR c/78304 The testcases as written made assumptions about size_t and long being invalid for use with "%u". We only need some invalid type, so this patch converts them to attempt a "const char *" with "%u", which should be invalid for every target. gcc/testsuite/ChangeLog: PR c/78304 * gcc.dg/format/pr78304.c: Convert argument from integral type to a pointer. * gcc.dg/format/pr78304-2.c: Likewise. From-SVN: r244502 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.dg/format/pr78304-2.c | 4 ++-- gcc/testsuite/gcc.dg/format/pr78304.c | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 547272c7a0c..e8f00c195a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-01-16 David Malcolm + + PR c/78304 + * gcc.dg/format/pr78304.c: Convert argument from integral type + to a pointer. + * gcc.dg/format/pr78304-2.c: Likewise. + 2017-01-16 Carl Love * gcc.target/powerpc/builtins-3.c: New vec_nabs testcase. diff --git a/gcc/testsuite/gcc.dg/format/pr78304-2.c b/gcc/testsuite/gcc.dg/format/pr78304-2.c index 5ee6d659ea2..83648c46f6a 100644 --- a/gcc/testsuite/gcc.dg/format/pr78304-2.c +++ b/gcc/testsuite/gcc.dg/format/pr78304-2.c @@ -5,7 +5,7 @@ extern int printf (const char *, ...); # define PRIu32 "u" -void test (long size) +void test (const char *msg) { - printf ("size: %" PRIu32 "\n", size); /* { dg-warning "expects argument of type" } */ + printf ("size: %" PRIu32 "\n", msg); /* { dg-warning "expects argument of type" } */ } diff --git a/gcc/testsuite/gcc.dg/format/pr78304.c b/gcc/testsuite/gcc.dg/format/pr78304.c index d0a96f6ac4b..f6ad80793c7 100644 --- a/gcc/testsuite/gcc.dg/format/pr78304.c +++ b/gcc/testsuite/gcc.dg/format/pr78304.c @@ -4,7 +4,7 @@ #include #include -void test (size_t size) +void test (const char *msg) { - printf ("size: %" PRIu32 "\n", size); /* { dg-warning "expects argument of type" } */ + printf ("size: %" PRIu32 "\n", msg); /* { dg-warning "expects argument of type" } */ }