c90-printf-1.c, [...]: Adjust warning regular expressions.

* gcc.dg/c90-printf-1.c, gcc.dg/c90-printf-2.c,
	gcc.dg/c90-scanf-1.c, gcc.dg/c90-scanf-2.c, gcc.dg/c99-printf-1.c,
	gcc.dg/c99-scanf-1.c, gcc.dg/format-ext-1.c,
	gcc.dg/format-ext-2.c, gcc.dg/format-xopen-1.c,
	gcc.dg/formatz-1.c: Adjust warning regular expressions.

From-SVN: r36102
This commit is contained in:
Joseph Myers 2000-09-01 18:52:35 +01:00 committed by Joseph Myers
parent fcf1b822b4
commit f798660ee0
11 changed files with 294 additions and 286 deletions

View File

@ -1,3 +1,11 @@
2000-09-01 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/c90-printf-1.c, gcc.dg/c90-printf-2.c,
gcc.dg/c90-scanf-1.c, gcc.dg/c90-scanf-2.c, gcc.dg/c99-printf-1.c,
gcc.dg/c99-scanf-1.c, gcc.dg/format-ext-1.c,
gcc.dg/format-ext-2.c, gcc.dg/format-xopen-1.c,
gcc.dg/formatz-1.c: Adjust warning regular expressions.
2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.other/nested4.C: New test.

View File

@ -79,30 +79,30 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
*/
printf ("%ho%hu%hx%hX", u, u, u, u);
printf ("%hn", hn);
printf ("%hf", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%he", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hE", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hg", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hG", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hc", i); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hs", s); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hp", p); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hf", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%he", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hE", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hg", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hG", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hc", i); /* { dg-warning "length" "bad use of %h" } */
printf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */
printf ("%hp", p); /* { dg-warning "length" "bad use of %h" } */
printf ("%h"); /* { dg-warning "conversion lacks type" "bare %h" } */
printf ("%h."); /* { dg-warning "conversion" "bogus %h." } */
printf ("%ld%li%lo%lu%lx%lX", l, l, ul, ul, ul, ul);
printf ("%ln", ln);
printf ("%lf", d); /* { dg-warning "length character|C" "bad use of %l" } */
printf ("%le", d); /* { dg-warning "length character|C" "bad use of %l" } */
printf ("%lE", d); /* { dg-warning "length character|C" "bad use of %l" } */
printf ("%lg", d); /* { dg-warning "length character|C" "bad use of %l" } */
printf ("%lG", d); /* { dg-warning "length character|C" "bad use of %l" } */
printf ("%lp", p); /* { dg-warning "length character|C" "bad use of %l" } */
printf ("%lf", d); /* { dg-warning "length|C" "bad use of %l" } */
printf ("%le", d); /* { dg-warning "length|C" "bad use of %l" } */
printf ("%lE", d); /* { dg-warning "length|C" "bad use of %l" } */
printf ("%lg", d); /* { dg-warning "length|C" "bad use of %l" } */
printf ("%lG", d); /* { dg-warning "length|C" "bad use of %l" } */
printf ("%lp", p); /* { dg-warning "length|C" "bad use of %l" } */
/* These next two were added in C94, but should be objected to in C90.
For the first one, GCC has wanted wchar_t instead of the correct C94
and C99 wint_t.
*/
printf ("%lc", lc); /* { dg-warning "length character|C" "C90 bad use of %l" } */
printf ("%ls", ls); /* { dg-warning "length character|C" "C90 bad use of %l" } */
printf ("%lc", lc); /* { dg-warning "length|C" "C90 bad use of %l" } */
printf ("%ls", ls); /* { dg-warning "length|C" "C90 bad use of %l" } */
/* These uses of %L are legitimate, though GCC has wrongly warned for
them in the past.
*/
@ -116,10 +116,10 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
printf ("%Lu", ull); /* { dg-warning "does not support" "bad use of %L" } */
printf ("%Lx", ull); /* { dg-warning "does not support" "bad use of %L" } */
printf ("%LX", ull); /* { dg-warning "does not support" "bad use of %L" } */
printf ("%Lc", i); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Ls", s); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Lp", p); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Ln", n); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Lc", i); /* { dg-warning "length" "bad use of %L" } */
printf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */
printf ("%Lp", p); /* { dg-warning "length" "bad use of %L" } */
printf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */
/* Valid uses of each bare conversion. */
printf ("%d%i%o%u%x%X%f%e%E%g%G%c%s%p%n%%", i, i, u, u, u, u, d, d, d, d, d,
i, s, p, n);

View File

@ -24,11 +24,11 @@ foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t)
{
/* Some tests already in c90-printf-1.c, e.g. %lf. */
/* The widths hh, ll, j, z, t are new. */
printf ("%hhd", i); /* { dg-warning "length character|C" "%hh in C90" } */
printf ("%lld", ll); /* { dg-warning "length character|C" "%ll in C90" } */
printf ("%jd", j); /* { dg-warning "length character|C" "%j in C90" } */
printf ("%zu", z); /* { dg-warning "length character|C" "%z in C90" } */
printf ("%td", t); /* { dg-warning "length character|C" "%t in C90" } */
printf ("%hhd", i); /* { dg-warning "length|C" "%hh in C90" } */
printf ("%lld", ll); /* { dg-warning "length|C" "%ll in C90" } */
printf ("%jd", j); /* { dg-warning "length|C" "%j in C90" } */
printf ("%zu", z); /* { dg-warning "length|C" "%z in C90" } */
printf ("%td", t); /* { dg-warning "length|C" "%t in C90" } */
/* The formats F, a, A are new. */
printf ("%F", d); /* { dg-warning "C" "%F in C90" } */
printf ("%a", d); /* { dg-warning "C" "%a in C90" } */

View File

@ -53,24 +53,24 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
scanf ("%3n", n); /* { dg-warning "width" "width with %n" } */
/* Valid and invalid %h, %l, %L constructions. */
scanf ("%hd%hi%ho%hu%hx%hX%hn", hp, hp, uhp, uhp, uhp, uhp, hn);
scanf ("%he", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hE", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hf", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hg", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hG", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hs", s); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%h[ac]", s); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hc", s); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hp", pp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%he", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hE", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hf", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hg", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hG", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */
scanf ("%h[ac]", s); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hc", s); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hp", pp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%h"); /* { dg-warning "conversion lacks type" "bare %h" } */
scanf ("%h."); /* { dg-warning "conversion" "bogus %h" } */
scanf ("%ld%li%lo%lu%lx%lX%ln", lp, lp, ulp, ulp, ulp, ulp, ln);
scanf ("%le%lE%lf%lg%lG", dp, dp, dp, dp, dp);
scanf ("%lp", pp); /* { dg-warning "length character" "bad use of %l" } */
scanf ("%lp", pp); /* { dg-warning "length" "bad use of %l" } */
/* These next three formats were added in C94. */
scanf ("%ls", ls); /* { dg-warning "length character|C" "bad use of %l" } */
scanf ("%l[ac]", ls); /* { dg-warning "length character|C" "bad use of %l" } */
scanf ("%lc", ls); /* { dg-warning "length character|C" "bad use of %l" } */
scanf ("%ls", ls); /* { dg-warning "length|C" "bad use of %l" } */
scanf ("%l[ac]", ls); /* { dg-warning "length|C" "bad use of %l" } */
scanf ("%lc", ls); /* { dg-warning "length|C" "bad use of %l" } */
scanf ("%Le%LE%Lf%Lg%LG", ldp, ldp, ldp, ldp, ldp);
scanf ("%Ld", llp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%Li", llp); /* { dg-warning "does not support" "bad use of %L" } */
@ -78,11 +78,11 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
scanf ("%Lu", ullp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%Lx", ullp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%LX", ullp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%Ls", s); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%L[ac]", s); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Lc", s); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Lp", pp); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Ln", n); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */
scanf ("%L[ac]", s); /* { dg-warning "length" "bad use of %L" } */
scanf ("%Lc", s); /* { dg-warning "length" "bad use of %L" } */
scanf ("%Lp", pp); /* { dg-warning "length" "bad use of %L" } */
scanf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */
/* Valid uses of each bare conversion. */
scanf ("%d%i%o%u%x%X%e%E%f%g%G%s%[abc]%c%p%n%%", ip, ip, uip, uip, uip,
uip, fp, fp, fp, fp, fp, s, s, s, pp, n);

View File

@ -25,11 +25,11 @@ foo (signed char *hhp, float *fp, llong *llp, intmax_t *jp,
{
/* Some tests already in c90-scanf-1.c. */
/* The widths hh, ll, j, z, t are new. */
scanf ("%hhd", hhp); /* { dg-warning "length character|C" "%hh in C90" } */
scanf ("%lld", llp); /* { dg-warning "length character|C" "%ll in C90" } */
scanf ("%jd", jp); /* { dg-warning "length character|C" "%j in C90" } */
scanf ("%zu", zp); /* { dg-warning "length character|C" "%z in C90" } */
scanf ("%td", tp); /* { dg-warning "length character|C" "%t in C90" } */
scanf ("%hhd", hhp); /* { dg-warning "length|C" "%hh in C90" } */
scanf ("%lld", llp); /* { dg-warning "length|C" "%ll in C90" } */
scanf ("%jd", jp); /* { dg-warning "length|C" "%j in C90" } */
scanf ("%zu", zp); /* { dg-warning "length|C" "%z in C90" } */
scanf ("%td", tp); /* { dg-warning "length|C" "%t in C90" } */
/* The formats F, a, A are new. */
scanf ("%F", fp); /* { dg-warning "C" "%F in C90" } */
scanf ("%a", fp); /* { dg-warning "C" "%a in C90" } */

View File

@ -41,86 +41,86 @@ foo (int i, unsigned int u, double d, char *s, void *p, int *n,
or completely broken formats.
*/
/* Valid and invalid %h, %hh, %l, %ll, %j, %z, %t, %L constructions. */
printf ("%hf", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hF", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%he", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hE", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hg", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hG", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%ha", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hA", d); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hc", i); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hs", s); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hp", p); /* { dg-warning "length character" "bad use of %h" } */
printf ("%hf", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hF", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%he", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hE", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hg", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hG", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%ha", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hA", d); /* { dg-warning "length" "bad use of %h" } */
printf ("%hc", i); /* { dg-warning "length" "bad use of %h" } */
printf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */
printf ("%hp", p); /* { dg-warning "length" "bad use of %h" } */
printf ("%hhd%hhi%hho%hhu%hhx%hhX", i, i, u, u, u, u);
printf ("%hhn", ss);
printf ("%hhf", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhF", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhe", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhE", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhg", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhG", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hha", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhA", d); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhc", i); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhs", s); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhp", p); /* { dg-warning "length character" "bad use of %hh" } */
printf ("%hhf", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhF", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhe", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhE", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhg", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhG", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hha", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhA", d); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhc", i); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhs", s); /* { dg-warning "length" "bad use of %hh" } */
printf ("%hhp", p); /* { dg-warning "length" "bad use of %hh" } */
printf ("%lc", lc);
printf ("%ls", ls);
printf ("%lf%lF%le%lE%lg%lG%la%lA", d, d, d, d, d, d, d, d);
printf ("%lp", p); /* { dg-warning "length character|C" "bad use of %l" } */
printf ("%lp", p); /* { dg-warning "length|C" "bad use of %l" } */
printf ("%lld%lli%llo%llu%llx%llX", ll, ll, ull, ull, ull, ull);
printf ("%lln", lln);
printf ("%llf", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%llF", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%lle", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%llE", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%llg", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%llG", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%lla", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%llA", d); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%llc", i); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%lls", s); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%llp", p); /* { dg-warning "length character" "bad use of %ll" } */
printf ("%jd%ji%jo%ju%jx%jX", j, j, uj, uj, uj, uj); /* { dg-bogus "length character" "bogus %j warning" { xfail *-*-* } } */
printf ("%jn", jn); /* { dg-bogus "length character" "bogus %j warning" { xfail *-*-* } } */
printf ("%jf", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%jF", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%je", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%jE", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%jg", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%jG", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%ja", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%jA", d); /* { dg-warning "length character" "bad use of %j" } */
printf ("%jc", i); /* { dg-warning "length character" "bad use of %j" } */
printf ("%js", s); /* { dg-warning "length character" "bad use of %j" } */
printf ("%jp", p); /* { dg-warning "length character" "bad use of %j" } */
printf ("%llf", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%llF", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%lle", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%llE", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%llg", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%llG", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%lla", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%llA", d); /* { dg-warning "length" "bad use of %ll" } */
printf ("%llc", i); /* { dg-warning "length" "bad use of %ll" } */
printf ("%lls", s); /* { dg-warning "length" "bad use of %ll" } */
printf ("%llp", p); /* { dg-warning "length" "bad use of %ll" } */
printf ("%jd%ji%jo%ju%jx%jX", j, j, uj, uj, uj, uj); /* { dg-bogus "length" "bogus %j warning" { xfail *-*-* } } */
printf ("%jn", jn); /* { dg-bogus "length" "bogus %j warning" { xfail *-*-* } } */
printf ("%jf", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%jF", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%je", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%jE", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%jg", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%jG", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%ja", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%jA", d); /* { dg-warning "length" "bad use of %j" } */
printf ("%jc", i); /* { dg-warning "length" "bad use of %j" } */
printf ("%js", s); /* { dg-warning "length" "bad use of %j" } */
printf ("%jp", p); /* { dg-warning "length" "bad use of %j" } */
printf ("%zd%zi%zo%zu%zx%zX", sz, sz, z, z, z, z);
printf ("%zn", zn);
printf ("%zf", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zF", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%ze", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zE", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zg", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zG", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%za", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zA", d); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zc", i); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zs", s); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zp", p); /* { dg-warning "length character" "bad use of %z" } */
printf ("%zf", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%zF", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%ze", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%zE", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%zg", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%zG", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%za", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%zA", d); /* { dg-warning "length" "bad use of %z" } */
printf ("%zc", i); /* { dg-warning "length" "bad use of %z" } */
printf ("%zs", s); /* { dg-warning "length" "bad use of %z" } */
printf ("%zp", p); /* { dg-warning "length" "bad use of %z" } */
printf ("%td%ti%to%tu%tx%tX", t, t, t, t, t, t);
printf ("%tn", tn);
printf ("%tf", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tF", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%te", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tE", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tg", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tG", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%ta", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tA", d); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tc", i); /* { dg-warning "length character" "bad use of %t" } */
printf ("%ts", s); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tp", p); /* { dg-warning "length character" "bad use of %t" } */
printf ("%tf", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%tF", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%te", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%tE", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%tg", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%tG", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%ta", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%tA", d); /* { dg-warning "length" "bad use of %t" } */
printf ("%tc", i); /* { dg-warning "length" "bad use of %t" } */
printf ("%ts", s); /* { dg-warning "length" "bad use of %t" } */
printf ("%tp", p); /* { dg-warning "length" "bad use of %t" } */
printf ("%Le%LE%Lf%LF%Lg%LG%La%LA", ld, ld, ld, ld, ld, ld, ld, ld);
/* These next six are accepted by GCC as referring to long long,
but -pedantic correctly warns.
@ -131,10 +131,10 @@ foo (int i, unsigned int u, double d, char *s, void *p, int *n,
printf ("%Lu", ull); /* { dg-warning "does not support" "bad use of %L" } */
printf ("%Lx", ull); /* { dg-warning "does not support" "bad use of %L" } */
printf ("%LX", ull); /* { dg-warning "does not support" "bad use of %L" } */
printf ("%Lc", i); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Ls", s); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Lp", p); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Ln", n); /* { dg-warning "length character" "bad use of %L" } */
printf ("%Lc", i); /* { dg-warning "length" "bad use of %L" } */
printf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */
printf ("%Lp", p); /* { dg-warning "length" "bad use of %L" } */
printf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */
/* Valid uses of each bare conversion. */
printf ("%d%i%o%u%x%X%f%F%e%E%g%G%a%A%c%s%p%n%%", i, i, u, u, u, u,
d, d, d, d, d, d, d, d, i, s, p, n);

View File

@ -56,91 +56,91 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
scanf ("%3n", n); /* { dg-warning "width" "width with %n" } */
/* Valid and invalid %h, %hh, %l, %ll, %j, %z, %t, %L constructions. */
scanf ("%hd%hi%ho%hu%hx%hX%hn", hp, hp, uhp, uhp, uhp, uhp, hn);
scanf ("%ha", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hA", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%he", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hE", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hf", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hF", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hg", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hG", fp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hs", s); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%h[ac]", s); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hc", s); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%hp", pp); /* { dg-warning "length character" "bad use of %h" } */
scanf ("%ha", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hA", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%he", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hE", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hf", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hF", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hg", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hG", fp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */
scanf ("%h[ac]", s); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hc", s); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hp", pp); /* { dg-warning "length" "bad use of %h" } */
scanf ("%hhd%hhi%hho%hhu%hhx%hhX%hhn", hhp, hhp, uhhp, uhhp, uhhp, uhhp,
hhn);
scanf ("%hha", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhA", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhe", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhE", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhf", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhF", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhg", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhG", fp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhs", s); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hh[ac]", s); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhc", s); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hhp", pp); /* { dg-warning "length character" "bad use of %hh" } */
scanf ("%hha", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhA", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhe", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhE", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhf", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhF", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhg", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhG", fp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhs", s); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hh[ac]", s); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhc", s); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%hhp", pp); /* { dg-warning "length" "bad use of %hh" } */
scanf ("%ld%li%lo%lu%lx%lX%ln", lp, lp, ulp, ulp, ulp, ulp, ln);
scanf ("%la%lA%le%lE%lf%lF%lg%lG", dp, dp, dp, dp, dp, dp, dp, dp);
scanf ("%lp", pp); /* { dg-warning "length character" "bad use of %l" } */
scanf ("%lp", pp); /* { dg-warning "length" "bad use of %l" } */
scanf ("%ls", ls);
scanf ("%l[ac]", ls);
scanf ("%lc", ls);
scanf ("%lld%lli%llo%llu%llx%llX%lln", llp, llp, ullp, ullp, ullp, ullp,
lln);
scanf ("%lla", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llA", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%lle", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llE", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llf", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llF", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llg", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llG", fp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%lls", s); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%ll[ac]", s); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llc", s); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%llp", pp); /* { dg-warning "length character" "bad use of %ll" } */
scanf ("%jd%ji%jo%ju%jx%jX%jn", jp, jp, ujp, ujp, ujp, ujp, jn); /* { dg-bogus "length character" "bogus %j warning" { xfail *-*-* } } */
scanf ("%ja", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jA", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%je", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jE", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jf", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jF", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jg", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jG", fp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%js", s); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%j[ac]", s); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jc", s); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%jp", pp); /* { dg-warning "length character" "bad use of %j" } */
scanf ("%lla", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llA", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%lle", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llE", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llf", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llF", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llg", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llG", fp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%lls", s); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%ll[ac]", s); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llc", s); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%llp", pp); /* { dg-warning "length" "bad use of %ll" } */
scanf ("%jd%ji%jo%ju%jx%jX%jn", jp, jp, ujp, ujp, ujp, ujp, jn); /* { dg-bogus "length" "bogus %j warning" { xfail *-*-* } } */
scanf ("%ja", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jA", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%je", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jE", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jf", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jF", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jg", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jG", fp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%js", s); /* { dg-warning "length" "bad use of %j" } */
scanf ("%j[ac]", s); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jc", s); /* { dg-warning "length" "bad use of %j" } */
scanf ("%jp", pp); /* { dg-warning "length" "bad use of %j" } */
scanf ("%zd%zi%zo%zu%zx%zX%zn", szp, szp, zp, zp, zp, zp, zn);
scanf ("%za", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zA", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%ze", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zE", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zf", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zF", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zg", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zG", fp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zs", s); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%z[ac]", s); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zc", s); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%zp", pp); /* { dg-warning "length character" "bad use of %z" } */
scanf ("%za", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zA", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%ze", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zE", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zf", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zF", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zg", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zG", fp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zs", s); /* { dg-warning "length" "bad use of %z" } */
scanf ("%z[ac]", s); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zc", s); /* { dg-warning "length" "bad use of %z" } */
scanf ("%zp", pp); /* { dg-warning "length" "bad use of %z" } */
scanf ("%td%ti%to%tu%tx%tX%tn", tp, tp, utp, utp, utp, utp, tn);
scanf ("%ta", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tA", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%te", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tE", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tf", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tF", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tg", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tG", fp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%ts", s); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%t[ac]", s); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tc", s); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%tp", pp); /* { dg-warning "length character" "bad use of %t" } */
scanf ("%ta", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tA", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%te", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tE", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tf", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tF", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tg", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tG", fp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%ts", s); /* { dg-warning "length" "bad use of %t" } */
scanf ("%t[ac]", s); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tc", s); /* { dg-warning "length" "bad use of %t" } */
scanf ("%tp", pp); /* { dg-warning "length" "bad use of %t" } */
scanf ("%La%LA%Le%LE%Lf%LF%Lg%LG", ldp, ldp, ldp, ldp, ldp, ldp, ldp, ldp);
scanf ("%Ld", llp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%Li", llp); /* { dg-warning "does not support" "bad use of %L" } */
@ -148,11 +148,11 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
scanf ("%Lu", ullp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%Lx", ullp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%LX", ullp); /* { dg-warning "does not support" "bad use of %L" } */
scanf ("%Ls", s); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%L[ac]", s); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Lc", s); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Lp", pp); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Ln", n); /* { dg-warning "length character" "bad use of %L" } */
scanf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */
scanf ("%L[ac]", s); /* { dg-warning "length" "bad use of %L" } */
scanf ("%Lc", s); /* { dg-warning "length" "bad use of %L" } */
scanf ("%Lp", pp); /* { dg-warning "length" "bad use of %L" } */
scanf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */
/* Valid uses of each bare conversion. */
scanf ("%d%i%o%u%x%X%a%A%e%E%f%F%g%G%s%[abc]%c%p%n%%", ip, ip, uip, uip, uip,
uip, fp, fp, fp, fp, fp, fp, fp, fp, s, s, s, pp, n);

View File

@ -24,44 +24,44 @@ foo (quad_t q, u_quad_t uq, quad_t *qn, size_t z, size_t *zn, long long int ll,
This is largely obsoleted in C99 by %j, %ll and PRId64.
*/
printf ("%qd%qi%qo%qu%qx%qX%qn", q, q, uq, uq, uq, uq, qn);
printf ("%qf", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qF", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qe", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qE", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qg", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qG", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qa", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qA", d); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qc", i); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qs", s); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qp", p); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qC", lc); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qS", ls); /* { dg-warning "length character" "bad use of %q" } */
/* With a bad length character GCC wants some argument, any argument,
printf ("%qf", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qF", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qe", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qE", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qg", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qG", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qa", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qA", d); /* { dg-warning "length" "bad use of %q" } */
printf ("%qc", i); /* { dg-warning "length" "bad use of %q" } */
printf ("%qs", s); /* { dg-warning "length" "bad use of %q" } */
printf ("%qp", p); /* { dg-warning "length" "bad use of %q" } */
printf ("%qC", lc); /* { dg-warning "length" "bad use of %q" } */
printf ("%qS", ls); /* { dg-warning "length" "bad use of %q" } */
/* With a bad length GCC wants some argument, any argument,
to devour with the format conversion, as a synchronisation heuristic.
This may get improved later.
*/
printf ("%qm", i); /* { dg-warning "length character" "bad use of %q" } */
printf ("%qm", i); /* { dg-warning "length" "bad use of %q" } */
/* As an extension, GCC allows the length "Z" as a synonym for "z".
This was an extension predating C99 which should now be considered
deprecated; use the standard "z" instead.
*/
printf ("%Zd%Zi%Zo%Zu%Zx%ZX", z, z, z, z, z, z);
printf ("%Zn", zn);
printf ("%Zf", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%ZF", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Ze", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%ZE", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Zg", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%ZG", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Za", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%ZA", d); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Zc", i); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Zs", s); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Zp", p); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%ZC", lc); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%ZS", ls); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Zm", i); /* { dg-warning "length character" "bad use of %Z" } */
printf ("%Zf", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%ZF", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%Ze", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%ZE", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%Zg", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%ZG", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%Za", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%ZA", d); /* { dg-warning "length" "bad use of %Z" } */
printf ("%Zc", i); /* { dg-warning "length" "bad use of %Z" } */
printf ("%Zs", s); /* { dg-warning "length" "bad use of %Z" } */
printf ("%Zp", p); /* { dg-warning "length" "bad use of %Z" } */
printf ("%ZC", lc); /* { dg-warning "length" "bad use of %Z" } */
printf ("%ZS", ls); /* { dg-warning "length" "bad use of %Z" } */
printf ("%Zm", i); /* { dg-warning "length" "bad use of %Z" } */
/* As an extension, GCC allows the length "L" on integer formats
(but not %n) as a synonym for "ll".
This should be considered deprecated.
@ -83,16 +83,16 @@ foo (quad_t q, u_quad_t uq, quad_t *qn, size_t z, size_t *zn, long long int ll,
printf ("%#m"); /* { dg-warning "flag" "bad %#m" } */
printf ("%0m"); /* { dg-warning "flag" "bad %0m" } */
printf ("%'m"); /* { dg-warning "flag" "bad %'m" } */
printf ("%hm", i); /* { dg-warning "length character" "bad %hm" } */
printf ("%hhm", i); /* { dg-warning "length character" "bad %hhm" } */
printf ("%lm", i); /* { dg-warning "length character" "bad %lm" } */
printf ("%llm", i); /* { dg-warning "length character" "bad %llm" } */
printf ("%jm", i); /* { dg-warning "length character" "bad %jm" } */
printf ("%zm", i); /* { dg-warning "length character" "bad %zm" } */
printf ("%tm", i); /* { dg-warning "length character" "bad %tm" } */
printf ("%Lm", i); /* { dg-warning "length character" "bad %Lm" } */
printf ("%qm", i); /* { dg-warning "length character" "bad %qm" } */
printf ("%Zm", i); /* { dg-warning "length character" "bad %Zm" } */
printf ("%hm", i); /* { dg-warning "length" "bad %hm" } */
printf ("%hhm", i); /* { dg-warning "length" "bad %hhm" } */
printf ("%lm", i); /* { dg-warning "length" "bad %lm" } */
printf ("%llm", i); /* { dg-warning "length" "bad %llm" } */
printf ("%jm", i); /* { dg-warning "length" "bad %jm" } */
printf ("%zm", i); /* { dg-warning "length" "bad %zm" } */
printf ("%tm", i); /* { dg-warning "length" "bad %tm" } */
printf ("%Lm", i); /* { dg-warning "length" "bad %Lm" } */
printf ("%qm", i); /* { dg-warning "length" "bad %qm" } */
printf ("%Zm", i); /* { dg-warning "length" "bad %Zm" } */
/* As an extension, glibc includes the "I" flag for decimal integer
formats, to output using the locale's digits (e.g. in Arabic).
In GCC, we require this to be in the standard place for flags, though

View File

@ -21,20 +21,20 @@ foo (quad_t *qp, u_quad_t *uqp, quad_t *qn, long long int *llp,
This is largely obsoleted in C99 by %j, %ll and SCNd64.
*/
scanf ("%qd%qi%qo%qu%qx%qX%qn", qp, qp, uqp, uqp, uqp, uqp, qn);
scanf ("%qf", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qF", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qe", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qE", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qg", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qG", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qa", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qA", fp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qs", s); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%q[abc]", s); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qc", s); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qp", pp); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qC", ls); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qS", ls); /* { dg-warning "length character" "bad use of %q" } */
scanf ("%qf", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qF", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qe", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qE", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qg", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qG", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qa", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qA", fp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qs", s); /* { dg-warning "length" "bad use of %q" } */
scanf ("%q[abc]", s); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qc", s); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qp", pp); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qC", ls); /* { dg-warning "length" "bad use of %q" } */
scanf ("%qS", ls); /* { dg-warning "length" "bad use of %q" } */
/* As an extension, GCC allows the length "L" on integer formats
(but not %n) as a synonym for "ll".
This should be considered deprecated.

View File

@ -25,14 +25,14 @@ foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d,
printf ("%C", lc);
printf ("%3C", lc);
printf ("%.3C", lc); /* { dg-warning "precision" "precision with %C" } */
printf ("%hC", lc); /* { dg-warning "length character" "bad %hC" } */
printf ("%hhC", lc); /* { dg-warning "length character" "bad %hhC" } */
printf ("%lC", lc); /* { dg-warning "length character" "bad %lC" } */
printf ("%llC", lc); /* { dg-warning "length character" "bad %llC" } */
printf ("%jC", lc); /* { dg-warning "length character" "bad %jC" } */
printf ("%zC", lc); /* { dg-warning "length character" "bad %zC" } */
printf ("%tC", lc); /* { dg-warning "length character" "bad %tC" } */
printf ("%LC", lc); /* { dg-warning "length character" "bad %LC" } */
printf ("%hC", lc); /* { dg-warning "length" "bad %hC" } */
printf ("%hhC", lc); /* { dg-warning "length" "bad %hhC" } */
printf ("%lC", lc); /* { dg-warning "length" "bad %lC" } */
printf ("%llC", lc); /* { dg-warning "length" "bad %llC" } */
printf ("%jC", lc); /* { dg-warning "length" "bad %jC" } */
printf ("%zC", lc); /* { dg-warning "length" "bad %zC" } */
printf ("%tC", lc); /* { dg-warning "length" "bad %tC" } */
printf ("%LC", lc); /* { dg-warning "length" "bad %LC" } */
printf ("%-C", lc);
printf ("%+C", lc); /* { dg-warning "flag" "bad %+C" } */
printf ("% C", lc); /* { dg-warning "flag" "bad % C" } */
@ -42,14 +42,14 @@ foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d,
printf ("%S", ls);
printf ("%3S", ls);
printf ("%.3S", ls);
printf ("%hS", ls); /* { dg-warning "length character" "bad %hS" } */
printf ("%hhS", ls); /* { dg-warning "length character" "bad %hhS" } */
printf ("%lS", ls); /* { dg-warning "length character" "bad %lS" } */
printf ("%llS", ls); /* { dg-warning "length character" "bad %llS" } */
printf ("%jS", ls); /* { dg-warning "length character" "bad %jS" } */
printf ("%zS", ls); /* { dg-warning "length character" "bad %zS" } */
printf ("%tS", ls); /* { dg-warning "length character" "bad %tS" } */
printf ("%LS", ls); /* { dg-warning "length character" "bad %LS" } */
printf ("%hS", ls); /* { dg-warning "length" "bad %hS" } */
printf ("%hhS", ls); /* { dg-warning "length" "bad %hhS" } */
printf ("%lS", ls); /* { dg-warning "length" "bad %lS" } */
printf ("%llS", ls); /* { dg-warning "length" "bad %llS" } */
printf ("%jS", ls); /* { dg-warning "length" "bad %jS" } */
printf ("%zS", ls); /* { dg-warning "length" "bad %zS" } */
printf ("%tS", ls); /* { dg-warning "length" "bad %tS" } */
printf ("%LS", ls); /* { dg-warning "length" "bad %LS" } */
printf ("%-S", ls);
printf ("%+S", ls); /* { dg-warning "flag" "bad %+S" } */
printf ("% S", ls); /* { dg-warning "flag" "bad % S" } */
@ -60,22 +60,22 @@ foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d,
scanf ("%S", ls);
scanf ("%*C%*S");
scanf ("%2C%3S", ls, ls);
scanf ("%hC", ls); /* { dg-warning "length character" "bad %hC" } */
scanf ("%hhC", ls); /* { dg-warning "length character" "bad %hhC" } */
scanf ("%lC", ls); /* { dg-warning "length character" "bad %lC" } */
scanf ("%llC", ls); /* { dg-warning "length character" "bad %llC" } */
scanf ("%jC", ls); /* { dg-warning "length character" "bad %jC" } */
scanf ("%zC", ls); /* { dg-warning "length character" "bad %zC" } */
scanf ("%tC", ls); /* { dg-warning "length character" "bad %tC" } */
scanf ("%LC", ls); /* { dg-warning "length character" "bad %LC" } */
scanf ("%hS", ls); /* { dg-warning "length character" "bad %hS" } */
scanf ("%hhS", ls); /* { dg-warning "length character" "bad %hhS" } */
scanf ("%lS", ls); /* { dg-warning "length character" "bad %lS" } */
scanf ("%llS", ls); /* { dg-warning "length character" "bad %llS" } */
scanf ("%jS", ls); /* { dg-warning "length character" "bad %jS" } */
scanf ("%zS", ls); /* { dg-warning "length character" "bad %zS" } */
scanf ("%tS", ls); /* { dg-warning "length character" "bad %tS" } */
scanf ("%LS", ls); /* { dg-warning "length character" "bad %LS" } */
scanf ("%hC", ls); /* { dg-warning "length" "bad %hC" } */
scanf ("%hhC", ls); /* { dg-warning "length" "bad %hhC" } */
scanf ("%lC", ls); /* { dg-warning "length" "bad %lC" } */
scanf ("%llC", ls); /* { dg-warning "length" "bad %llC" } */
scanf ("%jC", ls); /* { dg-warning "length" "bad %jC" } */
scanf ("%zC", ls); /* { dg-warning "length" "bad %zC" } */
scanf ("%tC", ls); /* { dg-warning "length" "bad %tC" } */
scanf ("%LC", ls); /* { dg-warning "length" "bad %LC" } */
scanf ("%hS", ls); /* { dg-warning "length" "bad %hS" } */
scanf ("%hhS", ls); /* { dg-warning "length" "bad %hhS" } */
scanf ("%lS", ls); /* { dg-warning "length" "bad %lS" } */
scanf ("%llS", ls); /* { dg-warning "length" "bad %llS" } */
scanf ("%jS", ls); /* { dg-warning "length" "bad %jS" } */
scanf ("%zS", ls); /* { dg-warning "length" "bad %zS" } */
scanf ("%tS", ls); /* { dg-warning "length" "bad %tS" } */
scanf ("%LS", ls); /* { dg-warning "length" "bad %LS" } */
/* In C99 mode (even with extensions), %aS is a floating point
format followed by an S.
*/

View File

@ -12,7 +12,7 @@ size_t
foo (void)
{
size_t t;
scanf ("%zu", &t); /* { dg-bogus "length character|format" "bogus scanf warning" } */
scanf ("%zu", &t); /* { dg-bogus "length|format" "bogus scanf warning" } */
return t;
}