aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>1999-10-10 05:17:41 +0000
committerJeff Law <law@gcc.gnu.org>1999-10-09 23:17:41 -0600
commitba80674579d5de95a3b8d14187ceff27fc659b4b (patch)
treea00089698e35510504f9a3c898a4eb7641f9ed8f /gcc/c-common.c
parent7805bde9facc95087021382db9967bc274944eee (diff)
downloadgcc-ba80674579d5de95a3b8d14187ceff27fc659b4b.zip
gcc-ba80674579d5de95a3b8d14187ceff27fc659b4b.tar.gz
gcc-ba80674579d5de95a3b8d14187ceff27fc659b4b.tar.bz2
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
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index afdea93..3e9d962 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)