Commit c5412f06 by Joseph Myers Committed by Joseph Myers

c-common.c (check_format_info): Warn for a wide character string used as a…

c-common.c (check_format_info): Warn for a wide character string used as a non-wide format argument.

	* c-common.c (check_format_info): Warn for a wide character string
	used as a non-wide format argument.

testsuite:
	* gcc.dg/c90-printf-1.c: Add test for wide string format.

From-SVN: r36586
parent 1c44c45d
2000-09-24 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (check_format_info): Warn for a wide character string
used as a non-wide format argument.
2000-09-24 Joseph S. Myers <jsm28@cam.ac.uk>
* builtins.def (BUILT_IN_LLABS): Add.
* builtins.c (expand_builtin): Also abort on BUILT_IN_LLABS.
* c-common.c (c_common_nodes_builtins): Create builtin functions
......
......@@ -2040,6 +2040,11 @@ check_format_info (status, info, params)
status_warning (status, "format not a string literal, argument types not checked");
return;
}
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (format_tree))) != char_type_node)
{
status_warning (status, "format is a wide character string");
return;
}
format_chars = TREE_STRING_POINTER (format_tree);
format_length = TREE_STRING_LENGTH (format_tree);
if (format_length <= 1)
......
2000-09-24 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/c90-printf-1.c: Add test for wide string format.
2000-09-22 Geoff Keating <geoffk@cygnus.com>
* gcc.c-torture/compile/20000922-1.c: New file.
......
......@@ -243,5 +243,6 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
printf ("%"); /* { dg-warning "trailing" "trailing % warning" } */
printf ("%++d", i); /* { dg-warning "repeated" "repeated flag warning" } */
printf ("%n", cn); /* { dg-warning "constant" "%n with const" } */
printf ((const char *)L"foo"); /* { dg-warning "wide" "wide string" } */
/* Can we test for the warning for unterminated string formats? */
}
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