Commit 2588e44e by Joseph Myers Committed by Joseph Myers

c-common.c (FMT_FLAG_ARG_CONVERT, [...]): Define.

	* c-common.c (FMT_FLAG_ARG_CONVERT, FMT_FLAG_SCANF_A_KLUDGE,
	FMT_FLAG_FANCY_PERCENT_OK): Define.
	(format_char_info): Add flag "4" to comment.
	(format_flag_spec, format_flag_pair): New structures.
	(format_kind_info): Add additional fields to control format
	checking.
	(printf_flag_specs, printf_flag_pairs, scanf_flag_specs,
	scanf_flag_pairs, strftime_flag_specs, strftime_flag_pairs): New
	arrays.
	(time_char_table): Use "4" flag to handle %Ey.
	(format_types): Add entries for new fields.
	(get_flag_spec): New function.
	(check_format_info): Increase size of flag_chars[] to 256.
	Control format checking using the new fields of a format_kind_info
	and the new tables; remove all conditionals on printf_format_type,
	scanf_format_type or strftime_format_type.  Handle all details of
	bad combinations of flags (including width, precision and strftime
	modifiers) through data rather than ad hoc code.  Handle all
	details of standard versions in which flags appeared through
	data.  Use the "4" flag.

testsuite:
	* gcc.dg/c90-printf-1.c, gcc.dg/c90-scanf-1.c,
	gcc.dg/c99-printf-1.c, gcc.dg/c99-scanf-1.c,
	gcc.dg/c99-strftime-1.c, gcc.dg/format-ext-3.c: Adjust error
	regexps and details of expected handling of some bad formats.
	* gcc.dg/format-xopen-1.c: Add test for $ format with assignment
	suppression.

From-SVN: r36790
parent 7fd9a516
2000-10-08 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (FMT_FLAG_ARG_CONVERT, FMT_FLAG_SCANF_A_KLUDGE,
FMT_FLAG_FANCY_PERCENT_OK): Define.
(format_char_info): Add flag "4" to comment.
(format_flag_spec, format_flag_pair): New structures.
(format_kind_info): Add additional fields to control format
checking.
(printf_flag_specs, printf_flag_pairs, scanf_flag_specs,
scanf_flag_pairs, strftime_flag_specs, strftime_flag_pairs): New
arrays.
(time_char_table): Use "4" flag to handle %Ey.
(format_types): Add entries for new fields.
(get_flag_spec): New function.
(check_format_info): Increase size of flag_chars[] to 256.
Control format checking using the new fields of a format_kind_info
and the new tables; remove all conditionals on printf_format_type,
scanf_format_type or strftime_format_type. Handle all details of
bad combinations of flags (including width, precision and strftime
modifiers) through data rather than ad hoc code. Handle all
details of standard versions in which flags appeared through
data. Use the "4" flag.
2000-10-07 Will Cohen <wcohen@redhat.com>, Kazu Hirata <kazu@hxi.com> 2000-10-07 Will Cohen <wcohen@redhat.com>, Kazu Hirata <kazu@hxi.com>
* config/h8300/h8300.md: Remove the memory alternative and correct * config/h8300/h8300.md: Remove the memory alternative and correct
......
2000-10-08 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/c90-printf-1.c, gcc.dg/c90-scanf-1.c,
gcc.dg/c99-printf-1.c, gcc.dg/c99-scanf-1.c,
gcc.dg/c99-strftime-1.c, gcc.dg/format-ext-3.c: Adjust error
regexps and details of expected handling of some bad formats.
* gcc.dg/format-xopen-1.c: Add test for $ format with assignment
suppression.
2000-10-07 Joseph S. Myers <jsm28@cam.ac.uk> 2000-10-07 Joseph S. Myers <jsm28@cam.ac.uk>
* g++.old-deja/g++.eh/cond1.C, g++.old-deja/g++.other/bitfld3.C, * g++.old-deja/g++.eh/cond1.C, g++.old-deja/g++.other/bitfld3.C,
......
...@@ -140,8 +140,8 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, ...@@ -140,8 +140,8 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
/* Uses of the space flag (valid on signed conversions only, and ignored /* Uses of the space flag (valid on signed conversions only, and ignored
with +). with +).
*/ */
printf ("% +d", i); /* { dg-warning "use of both" "use of space and + flags" } */ printf ("% +d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */
printf ("%+ d", i); /* { dg-warning "use of both" "use of space and + flags" } */ printf ("%+ d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */
printf ("% d% i% f% e% E% g% G\n", i, i, d, d, d, d, d); printf ("% d% i% f% e% E% g% G\n", i, i, d, d, d, d, d);
printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */ printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */
printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */ printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */
...@@ -176,17 +176,17 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, ...@@ -176,17 +176,17 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
printf ("%08.5X", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ printf ("%08.5X", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */
printf ("%08.5f%08.5e%08.5E%08.5g%08.5G", d, d, d, d, d); printf ("%08.5f%08.5e%08.5E%08.5g%08.5G", d, d, d, d, d);
/* 0 flag ignored with - flag. */ /* 0 flag ignored with - flag. */
printf ("%-08d", i); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08d", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08i", i); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08i", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08o", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08o", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08u", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08u", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08x", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08x", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08X", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08X", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08e", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08e", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08E", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08E", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08f", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08f", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08g", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08g", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08G", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08G", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
/* Various tests of bad argument types. */ /* Various tests of bad argument types. */
printf ("%d", l); /* { dg-warning "format" "bad argument types" } */ printf ("%d", l); /* { dg-warning "format" "bad argument types" } */
printf ("%*.*d", l, i2, i); /* { dg-warning "field" "bad * argument types" } */ printf ("%*.*d", l, i2, i); /* { dg-warning "field" "bad * argument types" } */
......
...@@ -44,7 +44,7 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp, ...@@ -44,7 +44,7 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
/* Valid, invalid and silly assignment-suppression constructions. */ /* Valid, invalid and silly assignment-suppression constructions. */
scanf ("%*d%*i%*o%*u%*x%*X%*e%*E%*f%*g%*G%*s%*[abc]%*c%*p"); scanf ("%*d%*i%*o%*u%*x%*X%*e%*E%*f%*g%*G%*s%*[abc]%*c%*p");
scanf ("%*2d%*8s%*3c"); scanf ("%*2d%*8s%*3c");
scanf ("%*n"); /* { dg-warning "suppress" "suppression of %n" } */ scanf ("%*n", n); /* { dg-warning "suppress" "suppression of %n" } */
scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */ scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */
/* Valid, invalid and silly width constructions. */ /* Valid, invalid and silly width constructions. */
scanf ("%2d%3i%4o%5u%6x%7X%8e%9E%10f%11g%12G%13s%14[abc]%15c%16p", scanf ("%2d%3i%4o%5u%6x%7X%8e%9E%10f%11g%12G%13s%14[abc]%15c%16p",
......
...@@ -155,8 +155,8 @@ foo (int i, unsigned int u, double d, char *s, void *p, int *n, ...@@ -155,8 +155,8 @@ foo (int i, unsigned int u, double d, char *s, void *p, int *n,
/* Uses of the space flag (valid on signed conversions only, and ignored /* Uses of the space flag (valid on signed conversions only, and ignored
with +). with +).
*/ */
printf ("% +d", i); /* { dg-warning "use of both" "use of space and + flags" } */ printf ("% +d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */
printf ("%+ d", i); /* { dg-warning "use of both" "use of space and + flags" } */ printf ("%+ d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */
printf ("% d% i% f% F% e% E% g% G% a% A\n", i, i, d, d, d, d, d, d, d, d); printf ("% d% i% f% F% e% E% g% G% a% A\n", i, i, d, d, d, d, d, d, d, d);
printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */ printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */
printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */ printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */
...@@ -193,20 +193,20 @@ foo (int i, unsigned int u, double d, char *s, void *p, int *n, ...@@ -193,20 +193,20 @@ foo (int i, unsigned int u, double d, char *s, void *p, int *n,
printf ("%08.5f%08.5F%08.5e%08.5E%08.5g%08.5G%08.5a%08.5A", printf ("%08.5f%08.5F%08.5e%08.5E%08.5g%08.5G%08.5a%08.5A",
d, d, d, d, d, d, d, d); d, d, d, d, d, d, d, d);
/* 0 flag ignored with - flag. */ /* 0 flag ignored with - flag. */
printf ("%-08d", i); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08d", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08i", i); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08i", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08o", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08o", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08u", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08u", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08x", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08x", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08X", u); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08X", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08e", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08e", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08E", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08E", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08f", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08f", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08F", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08F", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08g", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08g", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08G", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08G", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08a", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08a", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
printf ("%-08A", d); /* { dg-warning "flags" "0 flag ignored with - flag" } */ printf ("%-08A", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */
/* Various tests of bad argument types. Mostly covered in c90-printf-1.c; /* Various tests of bad argument types. Mostly covered in c90-printf-1.c;
here just test for pointer target sign with %hhn. (Probably allowed here just test for pointer target sign with %hhn. (Probably allowed
by the standard, but a bad idea, so GCC should diagnose if what by the standard, but a bad idea, so GCC should diagnose if what
......
...@@ -47,7 +47,7 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp, ...@@ -47,7 +47,7 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
*/ */
scanf ("%*d%*i%*o%*u%*x%*X%*a%*A%*e%*E%*f%*F%*g%*G%*s%*[abc]%*c%*p"); scanf ("%*d%*i%*o%*u%*x%*X%*a%*A%*e%*E%*f%*F%*g%*G%*s%*[abc]%*c%*p");
scanf ("%*2d%*8s%*3c"); scanf ("%*2d%*8s%*3c");
scanf ("%*n"); /* { dg-warning "suppress" "suppression of %n" } */ scanf ("%*n", n); /* { dg-warning "suppress" "suppression of %n" } */
scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */ scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */
scanf ("%2d%3i%4o%5u%6x%7X%8a%9A%10e%11E%12f%13F%14g%15G%16s%3[abc]%4c%5p", scanf ("%2d%3i%4o%5u%6x%7X%8a%9A%10e%11E%12f%13F%14g%15G%16s%3[abc]%4c%5p",
ip, ip, uip, uip, uip, uip, fp, fp, fp, fp, fp, fp, fp, fp, ip, ip, uip, uip, uip, uip, fp, fp, fp, fp, fp, fp, fp, fp,
......
...@@ -31,69 +31,71 @@ foo (char *s, size_t m, const struct tm *tp) ...@@ -31,69 +31,71 @@ foo (char *s, size_t m, const struct tm *tp)
*/ */
strftime (s, m, "%Ey", tp); /* { dg-warning "some locales" "2-digit year" } */ strftime (s, m, "%Ey", tp); /* { dg-warning "some locales" "2-digit year" } */
/* Bad uses of %E and %O. */ /* Bad uses of %E and %O. */
strftime (s, m, "%EEY", tp); /* { dg-warning "multiple" "multiple %E/%O" } */ strftime (s, m, "%EEY", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */
strftime (s, m, "%EOY", tp); /* { dg-warning "multiple" "multiple %E/%O" } */ strftime (s, m, "%EOy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
strftime (s, m, "%OEV", tp); /* { dg-warning "multiple" "multiple %E/%O" } */ strftime (s, m, "%OEy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
strftime (s, m, "%OOV", tp); /* { dg-warning "multiple" "multiple %E/%O" } */ strftime (s, m, "%OOV", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */
strftime (s, m, "%Ea", tp); /* { dg-warning "flag" "bad %Ea" } */ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 35 } */
strftime (s, m, "%EA", tp); /* { dg-warning "flag" "bad %EA" } */ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 36 } */
strftime (s, m, "%Eb", tp); /* { dg-warning "flag" "bad %Eb" } */ strftime (s, m, "%Ea", tp); /* { dg-warning "flag|modifier" "bad %Ea" } */
strftime (s, m, "%EB", tp); /* { dg-warning "flag" "bad %EB" } */ strftime (s, m, "%EA", tp); /* { dg-warning "flag|modifier" "bad %EA" } */
strftime (s, m, "%Ed", tp); /* { dg-warning "flag" "bad %Ed" } */ strftime (s, m, "%Eb", tp); /* { dg-warning "flag|modifier" "bad %Eb" } */
strftime (s, m, "%ED", tp); /* { dg-warning "flag" "bad %ED" } */ strftime (s, m, "%EB", tp); /* { dg-warning "flag|modifier" "bad %EB" } */
/* { dg-warning "only last 2" "2-digit year" { target *-*-* } 43 } */ strftime (s, m, "%Ed", tp); /* { dg-warning "flag|modifier" "bad %Ed" } */
strftime (s, m, "%Ee", tp); /* { dg-warning "flag" "bad %Ee" } */ strftime (s, m, "%ED", tp); /* { dg-warning "flag|modifier" "bad %ED" } */
strftime (s, m, "%EF", tp); /* { dg-warning "flag" "bad %EF" } */ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 45 } */
strftime (s, m, "%Eg", tp); /* { dg-warning "flag" "bad %Eg" } */ strftime (s, m, "%Ee", tp); /* { dg-warning "flag|modifier" "bad %Ee" } */
/* { dg-warning "only last 2" "2-digit year" { target *-*-* } 47 } */ strftime (s, m, "%EF", tp); /* { dg-warning "flag|modifier" "bad %EF" } */
strftime (s, m, "%EG", tp); /* { dg-warning "flag" "bad %EG" } */ strftime (s, m, "%Eg", tp); /* { dg-warning "flag|modifier" "bad %Eg" } */
strftime (s, m, "%Eh", tp); /* { dg-warning "flag" "bad %Eh" } */ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 49 } */
strftime (s, m, "%EH", tp); /* { dg-warning "flag" "bad %EH" } */ strftime (s, m, "%EG", tp); /* { dg-warning "flag|modifier" "bad %EG" } */
strftime (s, m, "%EI", tp); /* { dg-warning "flag" "bad %EI" } */ strftime (s, m, "%Eh", tp); /* { dg-warning "flag|modifier" "bad %Eh" } */
strftime (s, m, "%Ej", tp); /* { dg-warning "flag" "bad %Ej" } */ strftime (s, m, "%EH", tp); /* { dg-warning "flag|modifier" "bad %EH" } */
strftime (s, m, "%Em", tp); /* { dg-warning "flag" "bad %Em" } */ strftime (s, m, "%EI", tp); /* { dg-warning "flag|modifier" "bad %EI" } */
strftime (s, m, "%EM", tp); /* { dg-warning "flag" "bad %EM" } */ strftime (s, m, "%Ej", tp); /* { dg-warning "flag|modifier" "bad %Ej" } */
strftime (s, m, "%En", tp); /* { dg-warning "flag" "bad %En" } */ strftime (s, m, "%Em", tp); /* { dg-warning "flag|modifier" "bad %Em" } */
strftime (s, m, "%Ep", tp); /* { dg-warning "flag" "bad %Ep" } */ strftime (s, m, "%EM", tp); /* { dg-warning "flag|modifier" "bad %EM" } */
strftime (s, m, "%Er", tp); /* { dg-warning "flag" "bad %Er" } */ strftime (s, m, "%En", tp); /* { dg-warning "flag|modifier" "bad %En" } */
strftime (s, m, "%ER", tp); /* { dg-warning "flag" "bad %ER" } */ strftime (s, m, "%Ep", tp); /* { dg-warning "flag|modifier" "bad %Ep" } */
strftime (s, m, "%ES", tp); /* { dg-warning "flag" "bad %ES" } */ strftime (s, m, "%Er", tp); /* { dg-warning "flag|modifier" "bad %Er" } */
strftime (s, m, "%Et", tp); /* { dg-warning "flag" "bad %Et" } */ strftime (s, m, "%ER", tp); /* { dg-warning "flag|modifier" "bad %ER" } */
strftime (s, m, "%ET", tp); /* { dg-warning "flag" "bad %ET" } */ strftime (s, m, "%ES", tp); /* { dg-warning "flag|modifier" "bad %ES" } */
strftime (s, m, "%Eu", tp); /* { dg-warning "flag" "bad %Eu" } */ strftime (s, m, "%Et", tp); /* { dg-warning "flag|modifier" "bad %Et" } */
strftime (s, m, "%EU", tp); /* { dg-warning "flag" "bad %EU" } */ strftime (s, m, "%ET", tp); /* { dg-warning "flag|modifier" "bad %ET" } */
strftime (s, m, "%EV", tp); /* { dg-warning "flag" "bad %EV" } */ strftime (s, m, "%Eu", tp); /* { dg-warning "flag|modifier" "bad %Eu" } */
strftime (s, m, "%Ew", tp); /* { dg-warning "flag" "bad %Ew" } */ strftime (s, m, "%EU", tp); /* { dg-warning "flag|modifier" "bad %EU" } */
strftime (s, m, "%EW", tp); /* { dg-warning "flag" "bad %EW" } */ strftime (s, m, "%EV", tp); /* { dg-warning "flag|modifier" "bad %EV" } */
strftime (s, m, "%Ez", tp); /* { dg-warning "flag" "bad %Ez" } */ strftime (s, m, "%Ew", tp); /* { dg-warning "flag|modifier" "bad %Ew" } */
strftime (s, m, "%EZ", tp); /* { dg-warning "flag" "bad %EZ" } */ strftime (s, m, "%EW", tp); /* { dg-warning "flag|modifier" "bad %EW" } */
strftime (s, m, "%E%", tp); /* { dg-warning "flag" "bad %E%" } */ strftime (s, m, "%Ez", tp); /* { dg-warning "flag|modifier" "bad %Ez" } */
strftime (s, m, "%Oa", tp); /* { dg-warning "flag" "bad %Oa" } */ strftime (s, m, "%EZ", tp); /* { dg-warning "flag|modifier" "bad %EZ" } */
strftime (s, m, "%OA", tp); /* { dg-warning "flag" "bad %OA" } */ strftime (s, m, "%E%", tp); /* { dg-warning "flag|modifier" "bad %E%" } */
strftime (s, m, "%Ob", tp); /* { dg-warning "flag" "bad %Ob" } */ strftime (s, m, "%Oa", tp); /* { dg-warning "flag|modifier" "bad %Oa" } */
strftime (s, m, "%OB", tp); /* { dg-warning "flag" "bad %OB" } */ strftime (s, m, "%OA", tp); /* { dg-warning "flag|modifier" "bad %OA" } */
strftime (s, m, "%Oc", tp); /* { dg-warning "flag" "bad %Oc" } */ strftime (s, m, "%Ob", tp); /* { dg-warning "flag|modifier" "bad %Ob" } */
/* { dg-warning "in some locales" "2-digit year" { target *-*-* } 75 } */ strftime (s, m, "%OB", tp); /* { dg-warning "flag|modifier" "bad %OB" } */
strftime (s, m, "%OC", tp); /* { dg-warning "flag|C" "bad %OC" } */ strftime (s, m, "%Oc", tp); /* { dg-warning "flag|modifier" "bad %Oc" } */
strftime (s, m, "%OD", tp); /* { dg-warning "flag" "bad %OD" } */ /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 77 } */
/* { dg-warning "only last 2" "2-digit year" { target *-*-* } 78 } */ strftime (s, m, "%OC", tp); /* { dg-warning "flag|modifier|C" "bad %OC" } */
strftime (s, m, "%OF", tp); /* { dg-warning "flag" "bad %OF" } */ strftime (s, m, "%OD", tp); /* { dg-warning "flag|modifier" "bad %OD" } */
strftime (s, m, "%Og", tp); /* { dg-warning "flag|C" "bad %Og" } */ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 80 } */
/* { dg-warning "only last 2" "2-digit year" { target *-*-* } 81 } */ strftime (s, m, "%OF", tp); /* { dg-warning "flag|modifier" "bad %OF" } */
strftime (s, m, "%OG", tp); /* { dg-warning "flag|C" "bad %OG" } */ strftime (s, m, "%Og", tp); /* { dg-warning "flag|modifier|C" "bad %Og" } */
strftime (s, m, "%Oh", tp); /* { dg-warning "flag" "bad %Oh" } */ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 83 } */
strftime (s, m, "%Oj", tp); /* { dg-warning "flag|C" "bad %Oj" } */ strftime (s, m, "%OG", tp); /* { dg-warning "flag|modifier|C" "bad %OG" } */
strftime (s, m, "%On", tp); /* { dg-warning "flag" "bad %On" } */ strftime (s, m, "%Oh", tp); /* { dg-warning "flag|modifier" "bad %Oh" } */
strftime (s, m, "%Op", tp); /* { dg-warning "flag" "bad %Op" } */ strftime (s, m, "%Oj", tp); /* { dg-warning "flag|modifier|C" "bad %Oj" } */
strftime (s, m, "%Or", tp); /* { dg-warning "flag" "bad %Or" } */ strftime (s, m, "%On", tp); /* { dg-warning "flag|modifier" "bad %On" } */
strftime (s, m, "%OR", tp); /* { dg-warning "flag" "bad %OR" } */ strftime (s, m, "%Op", tp); /* { dg-warning "flag|modifier" "bad %Op" } */
strftime (s, m, "%Ot", tp); /* { dg-warning "flag" "bad %Ot" } */ strftime (s, m, "%Or", tp); /* { dg-warning "flag|modifier" "bad %Or" } */
strftime (s, m, "%OT", tp); /* { dg-warning "flag" "bad %OT" } */ strftime (s, m, "%OR", tp); /* { dg-warning "flag|modifier" "bad %OR" } */
strftime (s, m, "%Ox", tp); /* { dg-warning "flag" "bad %Ox" } */ strftime (s, m, "%Ot", tp); /* { dg-warning "flag|modifier" "bad %Ot" } */
/* { dg-warning "in some locales" "2-digit year" { target *-*-* } 92 } */ strftime (s, m, "%OT", tp); /* { dg-warning "flag|modifier" "bad %OT" } */
strftime (s, m, "%OX", tp); /* { dg-warning "flag" "bad %OX" } */ strftime (s, m, "%Ox", tp); /* { dg-warning "flag|modifier" "bad %Ox" } */
strftime (s, m, "%OY", tp); /* { dg-warning "flag|C" "bad %OY" } */ /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 94 } */
strftime (s, m, "%Oz", tp); /* { dg-warning "flag|C" "bad %Oz" } */ strftime (s, m, "%OX", tp); /* { dg-warning "flag|modifier" "bad %OX" } */
strftime (s, m, "%OZ", tp); /* { dg-warning "flag" "bad %OZ" } */ strftime (s, m, "%OY", tp); /* { dg-warning "flag|modifier|C" "bad %OY" } */
strftime (s, m, "%O%", tp); /* { dg-warning "flag" "bad %O%" } */ strftime (s, m, "%Oz", tp); /* { dg-warning "flag|modifier|C" "bad %Oz" } */
strftime (s, m, "%OZ", tp); /* { dg-warning "flag|modifier" "bad %OZ" } */
strftime (s, m, "%O%", tp); /* { dg-warning "flag|modifier" "bad %O%" } */
} }
...@@ -210,5 +210,5 @@ foo (char *s, size_t m, const struct tm *tp) ...@@ -210,5 +210,5 @@ foo (char *s, size_t m, const struct tm *tp)
covered in c99-strftime-1.c, except for the extension %P. covered in c99-strftime-1.c, except for the extension %P.
*/ */
strftime (s, m, "%OC%Og%OG%Oj%OY%Oz%Ok%Ol%Os", tp); /* { dg-warning "only last 2" "2-digit year" } */ strftime (s, m, "%OC%Og%OG%Oj%OY%Oz%Ok%Ol%Os", tp); /* { dg-warning "only last 2" "2-digit year" } */
strftime (s, m, "%OP", tp); /* { dg-warning "flag" "bad %OP" } */ strftime (s, m, "%OP", tp); /* { dg-warning "flag|modifier" "bad %OP" } */
} }
...@@ -119,4 +119,5 @@ foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d, ...@@ -119,4 +119,5 @@ foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d,
printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */ printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */
printf ("%2$d%1$d", i, i, i); /* { dg-warning "unused" "unused $ operand" } */ printf ("%2$d%1$d", i, i, i); /* { dg-warning "unused" "unused $ operand" } */
vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */ vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */
scanf ("%1$*d%1$d", ip); /* { dg-warning "operand" "operand number with suppression" } */
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment