aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-09-30 18:17:54 +0000
committerJoseph Myers <jsm@polyomino.org.uk>2004-09-30 18:17:54 +0000
commit8dd6fb96a8e359049ecf0e5ca8de2d499007f899 (patch)
tree8592fa3e677a407f40204d43f47d95cdc595ac7c
parent402ddcffa75286838530b44354ade80d751fd1fc (diff)
PR c/17730
* c-typeck.c (lvalue_or_else): Pass msgid directly to error. testsuite: * gcc.dg/pr17730-1.c: New test git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@88343 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-typeck.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr17730-1.c5
4 files changed, 19 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29486e3c983..4cdbe1b7407 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-30 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/17730
+ * c-typeck.c (lvalue_or_else): Pass msgid directly to error.
+
2004-09-30 Diego Novillo <dnovillo@redhat.com>
* tree-ssa-alias.c (collect_points_to_info_r): Move analysis of
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index d744296aa13..1d79b232a0b 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2682,7 +2682,9 @@ lvalue_p (tree ref)
}
/* Return nonzero if REF is an lvalue valid for this language;
- otherwise, print an error message and return zero. */
+ otherwise, print an error message and return zero. MSGID
+ is a format string which receives no arguments, but in which
+ formats such as %< and %> may occur. */
static int
lvalue_or_else (tree ref, const char *msgid)
@@ -2690,7 +2692,7 @@ lvalue_or_else (tree ref, const char *msgid)
int win = lvalue_p (ref);
if (! win)
- error ("%s", msgid);
+ error (msgid);
return win;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 13e29d9a153..819d4223cd3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-30 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/17730
+ * gcc.dg/pr17730-1.c: New test
+
2004-09-29 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/7425
diff --git a/gcc/testsuite/gcc.dg/pr17730-1.c b/gcc/testsuite/gcc.dg/pr17730-1.c
new file mode 100644
index 00000000000..0fede2f6d6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr17730-1.c
@@ -0,0 +1,5 @@
+/* Test formatting of message for invalid lvalue. Bug 17730. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+char *p = &'C'; /* { dg-error "error: invalid lvalue in unary '&'" } */