summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-21 02:22:08 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-21 02:22:08 +0000
commite35976b114cde73f3131da32a9bbbc6da1b13eb8 (patch)
tree4f046755cca3d6be85f4cf05610ef5313e865404 /gcc/c-common.c
parentb859c0f1ddca305e49affed122053aad04f8728d (diff)
downloadgcc-e35976b114cde73f3131da32a9bbbc6da1b13eb8.tar.gz
* c-common.c (lvalue_or_else): Replace by lvalue_error; only give
diagnostic without checking whether an lvalue. * c-common.h (lvalue_p): Remove. (enum lvalue_use): Update comment. (lvalue_or_else): Replace by lvalue_error. * c-typeck.c (lvalue_p): Make static. (lvalue_or_else): New. Call lvalue_error. cp: * cp-tree.h (lvalue_or_else, lvalue_p): New. * typeck.c (lvalue_or_else): New. Call lvalue_error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96776 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1851836e9df..9c6a9d141af 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5721,40 +5721,32 @@ fold_offsetof (tree expr)
return convert (size_type_node, fold_offsetof_1 (expr));
}
-/* Return nonzero if REF is an lvalue valid for this language;
- otherwise, print an error message and return zero. USE says
+/* Print an error message for an invalid lvalue. USE says
how the lvalue is being used and so selects the error message. */
-int
-lvalue_or_else (tree ref, enum lvalue_use use)
+void
+lvalue_error (enum lvalue_use use)
{
- int win = lvalue_p (ref);
-
- if (!win)
+ switch (use)
{
- switch (use)
- {
- case lv_assign:
- error ("invalid lvalue in assignment");
- break;
- case lv_increment:
- error ("invalid lvalue in increment");
- break;
- case lv_decrement:
- error ("invalid lvalue in decrement");
- break;
- case lv_addressof:
- error ("invalid lvalue in unary %<&%>");
- break;
- case lv_asm:
- error ("invalid lvalue in asm statement");
- break;
- default:
- gcc_unreachable ();
- }
+ case lv_assign:
+ error ("invalid lvalue in assignment");
+ break;
+ case lv_increment:
+ error ("invalid lvalue in increment");
+ break;
+ case lv_decrement:
+ error ("invalid lvalue in decrement");
+ break;
+ case lv_addressof:
+ error ("invalid lvalue in unary %<&%>");
+ break;
+ case lv_asm:
+ error ("invalid lvalue in asm statement");
+ break;
+ default:
+ gcc_unreachable ();
}
-
- return win;
}
#include "gt-c-common.h"