c-common.c (check_format_info): Warn if format string isn't a string literal.
* c-common.c (check_format_info): Warn if format string isn't a string literal. From-SVN: r29881
This commit is contained in:
parent
7805bde9fa
commit
ba80674579
@ -1,3 +1,8 @@
|
|||||||
|
Sat Oct 9 23:16:01 1999 Ken Raeburn <raeburn@mit.edu>
|
||||||
|
|
||||||
|
* c-common.c (check_format_info): Warn if format string isn't a
|
||||||
|
string literal.
|
||||||
|
|
||||||
Sat Oct 9 23:04:02 1999 Jonathan Larmour <jlarmour@cygnus.co.uk>
|
Sat Oct 9 23:04:02 1999 Jonathan Larmour <jlarmour@cygnus.co.uk>
|
||||||
|
|
||||||
* configure.in (arm*-*-*): Don't let autoconf remove brackets
|
* configure.in (arm*-*-*): Don't let autoconf remove brackets
|
||||||
|
@ -1488,10 +1488,20 @@ check_format_info (info, params)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TREE_CODE (format_tree) != ADDR_EXPR)
|
if (TREE_CODE (format_tree) != ADDR_EXPR)
|
||||||
return;
|
{
|
||||||
|
/* The user may get multiple warnings if the supplied argument
|
||||||
|
isn't even a string pointer. */
|
||||||
|
warning ("format not a string literal, argument types not checked");
|
||||||
|
return;
|
||||||
|
}
|
||||||
format_tree = TREE_OPERAND (format_tree, 0);
|
format_tree = TREE_OPERAND (format_tree, 0);
|
||||||
if (TREE_CODE (format_tree) != STRING_CST)
|
if (TREE_CODE (format_tree) != STRING_CST)
|
||||||
return;
|
{
|
||||||
|
/* The user may get multiple warnings if the supplied argument
|
||||||
|
isn't even a string pointer. */
|
||||||
|
warning ("format not a string literal, argument types not checked");
|
||||||
|
return;
|
||||||
|
}
|
||||||
format_chars = TREE_STRING_POINTER (format_tree);
|
format_chars = TREE_STRING_POINTER (format_tree);
|
||||||
format_length = TREE_STRING_LENGTH (format_tree);
|
format_length = TREE_STRING_LENGTH (format_tree);
|
||||||
if (format_length <= 1)
|
if (format_length <= 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user