summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-10 05:17:41 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-10 05:17:41 +0000
commitb7e644ba4600ba3ba49b889d0ddbde68ff3a6f2a (patch)
treea00089698e35510504f9a3c898a4eb7641f9ed8f
parent3843b057af1305e615283cb83bc74b4080598996 (diff)
downloadgcc-b7e644ba4600ba3ba49b889d0ddbde68ff3a6f2a.tar.gz
* c-common.c (check_format_info): Warn if format string isn't a
string literal. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29881 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-common.c14
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2257112c707..da2340a6fea 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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>
* configure.in (arm*-*-*): Don't let autoconf remove brackets
diff --git a/gcc/c-common.c b/gcc/c-common.c
index afdea93853a..3e9d962bde9 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1488,10 +1488,20 @@ check_format_info (info, params)
return;
}
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);
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_length = TREE_STRING_LENGTH (format_tree);
if (format_length <= 1)