diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-03 11:22:41 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-03 11:22:41 +0000 |
commit | d1b92730f38c5396f7f1c87b64a3d8579be78d73 (patch) | |
tree | 38cfca602874b8689177b11b1cd223ef979c0667 /gcc/c-objc-common.c | |
parent | e1aed66f129091f333c0f2d63065d37599a60703 (diff) | |
download | gcc-d1b92730f38c5396f7f1c87b64a3d8579be78d73.tar.gz |
2004-02-03 Paolo Bonzini <bonzini@gnu.org>
PR c/11658
PR c/13994
* Makefile.in (c-parse.o, c-convert.o, c-typeck.o): Depend
on langhooks.h.
* objc/Make-lang.in (objc-parse.o): Depend on langhooks.h.
* c-parse.in, c-convert.c, c-typeck.c, objc/objc-act.c:
Include langhooks.h. Replace c_common_truthvalue_conversion
with the truthvalue_conversion language hook throughout.
(expr_no_commas): Call default_conversion before save_expr
for the first term of the production 'x ? : y'.
* c-common.c (c_common_truthvalue_conversion): Remove
obsolete block. Invoke recursively the hook instead
of this function.
* c-convert.c (convert): handle ERROR_MARK_NODE.
* c-typeck.c (build_binary_op): handle ERROR_MARK_NODE
returned by the truthvalue_conversion language hook.
* c-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Use
c_objc_common_truthvalue_conversion.
* c-objc-common.c (c_objc_common_truthvalue_conversion):
New function.
* c-tree.h (c_objc_common_truthvalue_conversion): Declare it.
* objc/objc-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Use
c_objc_common_truthvalue_conversion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77168 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-objc-common.c')
-rw-r--r-- | gcc/c-objc-common.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index 5a57aa46065..73a3241a413 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -332,3 +332,32 @@ c_tree_printer (pretty_printer *pp, text_info *text) pp_string (pp, n); return true; } + +tree +c_objc_common_truthvalue_conversion (tree expr) +{ + retry: + switch (TREE_CODE (TREE_TYPE (expr))) + { + case ARRAY_TYPE: + expr = default_conversion (expr); + if (TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE) + goto retry; + + error ("used array that cannot be converted to pointer where scalar is required"); + return error_mark_node; + + case RECORD_TYPE: + error ("used struct type value where scalar is required"); + return error_mark_node; + + case UNION_TYPE: + error ("used union type value where scalar is required"); + return error_mark_node; + default: + break; + } + + return c_common_truthvalue_conversion (expr); +} + |