mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-01 06:35:39 +08:00
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
This commit is contained in:
parent
1c44c45dbf
commit
c5412f0646
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
@ -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)
|
||||
|
@ -1,3 +1,7 @@
|
||||
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? */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user