builtin-sprintf-warn-1.c: Cast int argument to %lc directive to wint_t to silence -Wformat warnings on...

gcc/testsuite/ChangeLog:
	* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Cast int argument to
	%lc directive to wint_t to silence -Wformat warnings on targets
	where the latter is a distinct type such as long.

From-SVN: r240758
This commit is contained in:
Martin Sebor 2016-10-04 23:00:42 +00:00 committed by Martin Sebor
parent 2db613e5d3
commit 7ec39552a5
2 changed files with 14 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2016-10-04 Martin Sebor <msebor@redhat.com>
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Cast int argument to
%lc directive to wint_t to silence -Wformat warnings on targets
where the latter is a distinct type such as long.
2016-10-04 Martin Sebor <msebor@redhat.com> 2016-10-04 Martin Sebor <msebor@redhat.com>
PR c++/77804 PR c++/77804

View File

@ -209,11 +209,11 @@ void test_sprintf_chk_c_const (void)
T (3, "%c%c", '1', '2'); T (3, "%c%c", '1', '2');
/* Wide characters. */ /* Wide characters. */
T (0, "%lc", 0); /* { dg-warning "nul past the end" } */ T (0, "%lc", (wint_t)0); /* { dg-warning "nul past the end" } */
T (1, "%lc", 0); T (1, "%lc", (wint_t)0);
T (1, "%lc%lc", 0, 0); T (1, "%lc%lc", (wint_t)0, (wint_t)0);
T (2, "%lc", 0); T (2, "%lc", (wint_t)0);
T (2, "%lc%lc", 0, 0); T (2, "%lc%lc", (wint_t)0, (wint_t)0);
/* The following could result in as few as no bytes and in as many as /* The following could result in as few as no bytes and in as many as
MB_CUR_MAX, but since the MB_CUR_MAX value is a runtime property MB_CUR_MAX, but since the MB_CUR_MAX value is a runtime property
@ -1244,9 +1244,9 @@ void test_snprintf_c_const (void)
T (3, "%c%c", '1', '2'); T (3, "%c%c", '1', '2');
/* Wide characters. */ /* Wide characters. */
T (0, "%lc", 0); T (0, "%lc", (wint_t)0);
T (1, "%lc", 0); T (1, "%lc", (wint_t)0);
T (2, "%lc", 0); T (2, "%lc", (wint_t)0);
/* The following could result in as few as a single byte and in as many /* The following could result in as few as a single byte and in as many
as MB_CUR_MAX, but since the MB_CUR_MAX value is a runtime property as MB_CUR_MAX, but since the MB_CUR_MAX value is a runtime property