Commit 18406601 by Paolo Bonzini Committed by Paolo Bonzini

c-format.c (enum format_specifier_kind, [...]): New.

gcc:
2010-11-13  Paolo Bonzini  <bonzini@gnu.org>

	* c-format.c (enum format_specifier_kind, kind_descriptions): New.
	(struct format_wanted_type): Replace field "name" with "kind", add
	"format_start" and "format_length".
	(check_format_info_main): Fill in new fields.  Fill in
	FORMAT_WANTED_TYPES even for missing arguments.  Move checks
	after the final NUL outside the while loop.  Do not include
	width and precision modifiers in the format_start/format_length
	of the main format.
	(check_format_types): Remove FORMAT_START and FORMAT_LENGTH
	arguments.  Compute WANTED_TYPE first so that format_type_warning
	can be called for missing arguments.  Adjust calls to
	format_type_warning.
	(format_type_warning): Fetch as much information as possible
	from format_wanted_type.  Adjust printing now that every
	warning has a "descr", as well as for missing argument warnings
	and to include % sign for format specifiers.

testsuite:
2010-11-13  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/format/few-1.c: New test.
	* gcc.dg/format/asm_fprintf-1.c: Adjust.
	* gcc.dg/format/c90-scanf-1.c: Adjust.
	* gcc.dg/format/cmn-err-1.c: Adjust.
	* gcc.dg/format/dfp-printf-1.c: Adjust.
	* gcc.dg/format/dfp-scanf-1.c: Adjust.
	* gcc.dg/format/gcc_diag-1.c: Adjust.
	* gcc.dg/format/ms_unnamed-1.c: Adjust.
	* gcc.dg/format/strfmon-1.c: Adjust.
	* gcc.dg/format/unnamed-1.c: Adjust.
	* gcc.dg/format/xopen-2.c: Adjust.
	* g++.dg/ext/builtin4.C: Adjust.
	* g++.dg/ext/builtin5.C: Adjust.

From-SVN: r166698
parent 5f33b972
2010-11-13 Paolo Bonzini <bonzini@gnu.org>
* c-format.c (enum format_specifier_kind, kind_descriptions): New.
(struct format_wanted_type): Replace field "name" with "kind", add
"format_start" and "format_length".
(check_format_info_main): Fill in new fields. Fill in
FORMAT_WANTED_TYPES even for missing arguments. Move checks
after the final NUL outside the while loop. Do not include
width and precision modifiers in the format_start/format_length
of the main format.
(check_format_types): Remove FORMAT_START and FORMAT_LENGTH
arguments. Compute WANTED_TYPE first so that format_type_warning
can be called for missing arguments. Adjust calls to
format_type_warning.
(format_type_warning): Fetch as much information as possible
from format_wanted_type. Adjust printing now that every
warning has a "descr", as well as for missing argument warnings
and to include % sign for format specifiers.
2010-11-12 Alexander Monakov <amonakov@ispras.ru>
PR rtl-optimization/46204
......@@ -3689,7 +3689,7 @@ s-constrs-h: $(MD_DEPS) build/genpreds$(build_exeext)
$(STAMP) s-constrs-h
target-hooks-def.h: s-target-hooks-def-h; @true
tm.texi: s-tm-texi; @true
tm.texi: s-tm-texi
s-target-hooks-def-h: build/genhooks$(build_exeext)
$(RUN_GEN) build/genhooks$(build_exeext) > tmp-target-hooks-def.h
......@@ -3942,7 +3942,9 @@ $(genprog:%=build/gen%$(build_exeext)): build/gen%$(build_exeext): build/gen%.o
+$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
$(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
# Generated source files for gengtype.
# Generated source files for gengtype. Prepend inclusion of
# bconfig.h because AIX requires _LARGE_FILES to be defined before
# any system header is included.
gengtype-lex.c : gengtype-lex.l
-$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
echo '#include "bconfig.h"' > $@.tmp; \
......
2010-11-13 Paolo Bonzini <bonzini@gnu.org>
* gcc.dg/format/few-1.c: New test.
* gcc.dg/format/asm_fprintf-1.c: Adjust.
* gcc.dg/format/c90-scanf-1.c: Adjust.
* gcc.dg/format/cmn-err-1.c: Adjust.
* gcc.dg/format/dfp-printf-1.c: Adjust.
* gcc.dg/format/dfp-scanf-1.c: Adjust.
* gcc.dg/format/gcc_diag-1.c: Adjust.
* gcc.dg/format/ms_unnamed-1.c: Adjust.
* gcc.dg/format/strfmon-1.c: Adjust.
* gcc.dg/format/unnamed-1.c: Adjust.
* gcc.dg/format/xopen-2.c: Adjust.
* g++.dg/ext/builtin4.C: Adjust.
* g++.dg/ext/builtin5.C: Adjust.
2010-11-12 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/pragma-diag-2.c: New test.
......
......@@ -6,5 +6,5 @@
extern "C" int printf(const char*,...);
void foo() {
printf("%d"); // { dg-warning "too few arguments" }
printf("%d"); // { dg-warning "expects a matching" }
}
......@@ -8,5 +8,5 @@ namespace std {
}
void foo() {
std::printf("%d"); // { dg-warning "too few arguments" }
std::printf("%d"); // { dg-warning "expects a matching" }
}
......@@ -62,7 +62,7 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
asm_fprintf ("%s", n); /* { dg-warning "format" "bad argument types" } */
/* Wrong number of arguments. */
asm_fprintf ("%d%d", i); /* { dg-warning "arguments" "wrong number of args" } */
asm_fprintf ("%d%d", i); /* { dg-warning "matching" "wrong number of args" } */
asm_fprintf ("%d", i, i); /* { dg-warning "arguments" "wrong number of args" } */
/* Miscellaneous bogus constructions. */
asm_fprintf (""); /* { dg-warning "zero-length" "warning for empty format" } */
......
......@@ -220,7 +220,7 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
*/
printf ("%*.*d", u1, u2, i);
/* Wrong number of arguments. */
printf ("%d%d", i); /* { dg-warning "arguments" "wrong number of args" } */
printf ("%d%d", i); /* { dg-warning "matching" "wrong number of args" } */
printf ("%d", i, i); /* { dg-warning "arguments" "wrong number of args" } */
/* Miscellaneous bogus constructions. */
printf (""); /* { dg-warning "zero-length" "warning for empty format" } */
......
......@@ -106,7 +106,7 @@ foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
scanf ("%s", cs); /* { dg-warning "constant" "%s writing into const" } */
scanf ("%p", pcp); /* { dg-warning "constant" "%p writing into const" } */
/* Wrong number of arguments. */
scanf ("%d%d", ip); /* { dg-warning "arguments" "wrong number of args" } */
scanf ("%d%d", ip); /* { dg-warning "matching" "wrong number of args" } */
scanf ("%d", ip, ip); /* { dg-warning "arguments" "wrong number of args" } */
/* Miscellaneous bogus constructions. */
scanf (""); /* { dg-warning "zero-length" "warning for empty format" } */
......
......@@ -28,11 +28,12 @@ int main()
cmn_err_func (0, "%16b", i, "\01Foo");
cmn_err_func (0, "%i", i); /* { dg-warning "unknown|too many" } */
cmn_err_func (0, "%d", l); /* { dg-warning "expects type" } */
cmn_err_func (0, "%b"); /* { dg-warning "too few" } */
cmn_err_func (0, "%b", i); /* { dg-warning "too few" } */
cmn_err_func (0, "%b", i, i); /* { dg-warning "expects type" } */
cmn_err_func (0, "%b", string, i); /* { dg-warning "expects type" } */
cmn_err_func (0, "%p", 3); /* { dg-warning "expects type" } */
cmn_err_func (0, "%d", l); /* { dg-warning "expects argument" } */
cmn_err_func (0, "%b"); /* { dg-warning "'int'" } */
/* { dg-warning "'char \\*'" "" { target *-*-solaris2.* } 32 } */
cmn_err_func (0, "%b", i); /* { dg-warning "matching" } */
cmn_err_func (0, "%b", i, i); /* { dg-warning "expects argument" } */
cmn_err_func (0, "%b", string, i); /* { dg-warning "expects argument" } */
cmn_err_func (0, "%p", 3); /* { dg-warning "expects argument" } */
return 0;
}
......@@ -43,44 +43,44 @@ foo (_Decimal32 x, _Decimal64 y, _Decimal128 z, int i, unsigned int j,
/* Check warnings for type mismatches. */
printf ("%Hf\n", y); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%HF\n", y); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%He\n", y); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%HE\n", y); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%Hg\n", y); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%HG\n", y); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%Hf\n", z); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%HF\n", z); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%He\n", z); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%HE\n", z); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%Hg\n", z); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%HG\n", z); /* { dg-warning "expects type" "bad use of %H" } */
printf ("%Df\n", x); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%DF\n", x); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%De\n", x); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%DE\n", x); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%Dg\n", x); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%DG\n", x); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%Df\n", z); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%DF\n", z); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%De\n", z); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%DE\n", z); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%Dg\n", z); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%DG\n", z); /* { dg-warning "expects type" "bad use of %D" } */
printf ("%DDf\n", x); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDF\n", x); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDe\n", x); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDE\n", x); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDg\n", x); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDG\n", x); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDf\n", y); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDF\n", y); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDe\n", y); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDE\n", y); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDg\n", y); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%DDG\n", y); /* { dg-warning "expects type" "bad use of %DD" } */
printf ("%Hf\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HF\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%He\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HE\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hg\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HG\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hf\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HF\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%He\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HE\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hg\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HG\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Df\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DF\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%De\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DE\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%Dg\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DG\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%Df\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DF\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%De\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DE\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%Dg\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DG\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DDf\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDF\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDe\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDE\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDg\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDG\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDf\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDF\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDe\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDE\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDg\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDG\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
/* Check for warnings for bad use of H, D, and DD length specifiers. */
......
......@@ -43,44 +43,44 @@ voo (_Decimal32 *x, _Decimal64 *y, _Decimal128 *z, int *i, unsigned int *j,
/* Check warnings for type mismatches. */
scanf ("%Hf", y); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%HF", y); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%He", y); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%HE", y); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%Hg", y); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%HG", y); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%Hf", z); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%HF", z); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%He", z); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%HE", z); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%Hg", z); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%HG", z); /* { dg-warning "expects type" "bad use of %H" } */
scanf ("%Hf", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HF", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%He", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HE", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hg", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HG", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hf", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HF", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%He", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HE", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hg", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HG", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Df", x); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%DF", x); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%De", x); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%DE", x); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%Dg", x); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%DG", x); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%Df", z); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%DF", z); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%De", z); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%DE", z); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%Dg", z); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%DG", z); /* { dg-warning "expects type" "bad use of %D" } */
scanf ("%Df", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DF", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%De", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DE", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%Dg", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DG", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%Df", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DF", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%De", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DE", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%Dg", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DG", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DDf", x); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDF", x); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDe", x); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDE", x); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDg", x); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDG", x); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDf", y); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDF", y); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDe", y); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDE", y); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDg", y); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDG", y); /* { dg-warning "expects type" "bad use of %DD" } */
scanf ("%DDf", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDF", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDe", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDE", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDg", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDG", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDf", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDF", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDe", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDE", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDg", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDG", y); /* { dg-warning "expects argument" "bad use of %DD" } */
/* Check for warnings for bad use of H, D, and DD length specifiers. */
......
/* { dg-do compile } */
/* { dg-options "-std=gnu89 -Wformat" } */
int f(int *ip, char *cp)
{
__builtin_printf ("%*.*s");
/* { dg-warning "field width specifier '\\*' expects a matching 'int' argument" "" { target *-*-* } 6 } */
/* { dg-warning "field precision specifier '\\.\\*' expects a matching 'int' argument" "" { target *-*-* } 6 } */
/* { dg-warning "format '%s' expects a matching 'char \\*' argument" "" { target *-*-* } 6 } */
__builtin_printf ("%*.*s", ip, *cp);
/* { dg-warning "field width specifier '\\*' expects argument of type 'int'" "" { target *-*-* } 10 } */
/* { dg-warning "format '%s' expects a matching 'char \\*' argument" "" { target *-*-* } 10 } */
__builtin_printf ("%s %i", ip, ip);
/* { dg-warning "format '%s' expects argument of type 'char \\*'" "" { target *-*-* } 13 } */
/* { dg-warning "format '%i' expects argument of type 'int'" "" { target *-*-* } 13 } */
__builtin_printf ("%s %i", cp);
/* { dg-warning "format '%i' expects a matching 'int' argument" "" { target *-*-* } 16 } */
__builtin_printf ("%lc");
/* { dg-warning "format '%lc' expects a matching 'wint_t' argument" "" { target *-*-* } 18 } */
__builtin_printf ("%lc", cp);
/* { dg-warning "format '%lc' expects argument of type 'wint_t'" "" { target *-*-* } 20 } */
__builtin_scanf ("%s");
/* { dg-warning "format '%s' expects a matching 'char \\*' argument" "" { target *-*-* } 22 } */
__builtin_scanf ("%i", cp);
/* { dg-warning "format '%i' expects argument of type 'int \\*'" "" { target *-*-* } 24 } */
__builtin_scanf ("%lc");
/* { dg-warning "format '%lc' expects a matching 'wchar_t \\*' argument" "" { target *-*-* } 26 } */
__builtin_scanf ("%lc", cp);
/* { dg-warning "format '%lc' expects argument of type 'wchar_t \\*'" "" { target *-*-* } 28 } */
}
......@@ -201,7 +201,7 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
diag ("%s", n); /* { dg-warning "format" "bad argument types" } */
/* Wrong number of arguments. */
diag ("%d%d", i); /* { dg-warning "arguments" "wrong number of args" } */
diag ("%d%d", i); /* { dg-warning "matching" "wrong number of args" } */
diag ("%d", i, i); /* { dg-warning "arguments" "wrong number of args" } */
/* Miscellaneous bogus constructions. */
diag (""); /* { dg-warning "zero-length" "warning for empty format" } */
......
......@@ -19,7 +19,7 @@
void
f (TItype x)
{
printf("%d", x); /* { dg-warning "expects type" } */
printf("%d", 141592653589793238462643383279502884197169399375105820974944); /* { dg-warning "expects type" } */
printf("%d", x); /* { dg-warning "expects argument" } */
printf("%d", 141592653589793238462643383279502884197169399375105820974944); /* { dg-warning "expects argument" } */
/* { dg-warning "unsigned only|too large" "constant" { target *-*-* } 23 } */
}
......@@ -54,7 +54,7 @@ foo (char *s, size_t m, double d, long double ld)
strfmon (s, m, "%.5%\n"); /* { dg-warning "format" "bogus %%" } */
strfmon (s, m, "%#5%\n"); /* { dg-warning "format" "bogus %%" } */
/* Miscellaneous bogus formats. */
strfmon (s, m, "%n%n", d); /* { dg-warning "arguments" "too few args" } */
strfmon (s, m, "%n%n", d); /* { dg-warning "matching" "too few args" } */
strfmon (s, m, ""); /* { dg-warning "zero-length" "empty" } */
strfmon (s, m, NULL); /* { dg-warning "null" "null format string" } */
strfmon (s, m, "%"); /* { dg-warning "trailing" "tailing %" } */
......
......@@ -19,7 +19,7 @@
void
f (TItype x)
{
printf("%d", x); /* { dg-warning "expects type" } */
printf("%d", 141592653589793238462643383279502884197169399375105820974944); /* { dg-warning "expects type" } */
printf("%d", x); /* { dg-warning "expects argument" } */
printf("%d", 141592653589793238462643383279502884197169399375105820974944); /* { dg-warning "expects argument" } */
/* { dg-warning "unsigned only|too large" "constant" { target *-*-* } 23 } */
}
......@@ -16,6 +16,6 @@ void
foo (int i, int j, va_list va)
{
printf("%2$*1$c", i, j);
printf("%2$*1$c %2$*1$c", i, j); /* { dg-bogus "too few" "bogus too few dollar" } */
vbar(va, "%*s"); /* { dg-bogus "too few" "bogus too few vprintf" } */
printf("%2$*1$c %2$*1$c", i, j); /* { dg-bogus "matching" "bogus too few dollar" } */
vbar(va, "%*s"); /* { dg-bogus "matching" "bogus too few vprintf" } */
}
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