* [PATCH] Move error_operand_p one level up
@ 2011-06-10 10:08 Paolo Carlini
2011-06-10 10:51 ` Richard Guenther
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Carlini @ 2011-06-10 10:08 UTC (permalink / raw)
To: gcc-patches; +Cc: Ian Lance Taylor, Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
Hi,
yesterday I noticed that, as I vaguely suspected for quite some time,
error_operand_p can be useful also outside the c++ front-end. The below,
which I bootstrapped c, c++, go, on x86_64-linux (and I'm finishing
testing) tries to do that, moving the macro one level up and using it in
all the suitable places I spotted.
What do people think?
Thanks,
Paolo.
////////////////////
[-- Attachment #2: CL_error_operand_p --]
[-- Type: text/plain, Size: 604 bytes --]
/gcc/cp
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (error_operand_p): Remove.
/gcc
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
* tree.h (error_operand_p): Add.
* dbxout.c (dbxout_type_fields): Use the latter.
* c-decl.c (add_stmt): Likewise.
* gimplify.c (omp_add_variable, omp_notice_variable,
gimplify_scan_omp_clauses): Likewise.
/gcc/go
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
* gofrontend/expressions.cc (Expression::convert_for_assignment,
Call_expression::do_get_tree,
Struct_construction_expression::do_get_tree): Use error_operand_p.
[-- Attachment #3: patch_error_operand_p --]
[-- Type: text/plain, Size: 4527 bytes --]
Index: tree.h
===================================================================
--- tree.h (revision 174893)
+++ tree.h (working copy)
@@ -4053,6 +4053,12 @@ enum ptrmemfunc_vbit_where_t
\f
#define NULL_TREE (tree) NULL
+/* True if NODE is an erroneous expression. */
+
+#define error_operand_p(NODE) \
+ ((NODE) == error_mark_node \
+ || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
+
extern tree decl_assembler_name (tree);
extern bool decl_assembler_name_equal (tree decl, const_tree asmname);
extern hashval_t decl_assembler_name_hash (const_tree asmname);
Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h (revision 174893)
+++ cp/cp-tree.h (working copy)
@@ -1123,12 +1123,6 @@ struct GTY(()) language_function {
#define ansi_assopname(CODE) \
(assignment_operator_name_info[(int) (CODE)].identifier)
-/* True if NODE is an erroneous expression. */
-
-#define error_operand_p(NODE) \
- ((NODE) == error_mark_node \
- || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
-\f
/* TRUE if a tree code represents a statement. */
extern bool statement_code_p[MAX_TREE_CODES];
Index: dbxout.c
===================================================================
--- dbxout.c (revision 174893)
+++ dbxout.c (working copy)
@@ -1510,7 +1510,7 @@ dbxout_type_fields (tree type)
{
/* If one of the nodes is an error_mark or its type is then
return early. */
- if (tem == error_mark_node || TREE_TYPE (tem) == error_mark_node)
+ if (error_operand_p (tem))
return;
/* Omit here local type decls until we know how to support them. */
Index: go/gofrontend/expressions.cc
===================================================================
--- go/gofrontend/expressions.cc (revision 174893)
+++ go/gofrontend/expressions.cc (working copy)
@@ -209,7 +209,7 @@ Expression::convert_for_assignment(Translate_conte
if (lhs_type->is_error() || rhs_type->is_error())
return error_mark_node;
- if (rhs_tree == error_mark_node || TREE_TYPE(rhs_tree) == error_mark_node)
+ if (error_operand_p (rhs_tree))
return error_mark_node;
Gogo* gogo = context->gogo();
@@ -8967,7 +8967,7 @@ Call_expression::do_get_tree(Translate_context* co
else
go_unreachable();
- if (fn == error_mark_node || TREE_TYPE(fn) == error_mark_node)
+ if (error_operand_p (fn))
{
delete[] args;
return error_mark_node;
@@ -11004,7 +11004,7 @@ Struct_construction_expression::do_get_tree(Transl
++pv;
}
- if (val == error_mark_node || TREE_TYPE(val) == error_mark_node)
+ if (error_operand_p (val))
return error_mark_node;
constructor_elt* elt = VEC_quick_push(constructor_elt, elts, NULL);
Index: c-decl.c
===================================================================
--- c-decl.c (revision 174893)
+++ c-decl.c (working copy)
@@ -565,7 +565,7 @@ add_stmt (tree t)
static bool
decl_jump_unsafe (tree decl)
{
- if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ if (error_operand_p (decl))
return false;
/* Always warn about crossing variably modified types. */
Index: gimplify.c
===================================================================
--- gimplify.c (revision 174893)
+++ gimplify.c (working copy)
@@ -5448,7 +5448,7 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tr
unsigned int nflags;
tree t;
- if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ if (error_operand_p (decl))
return;
/* Never elide decls whose type has TREE_ADDRESSABLE set. This means
@@ -5573,7 +5573,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx,
unsigned flags = in_code ? GOVD_SEEN : 0;
bool ret = false, shared;
- if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ if (error_operand_p (decl))
return false;
/* Threadprivate variables are predetermined. */
@@ -5830,7 +5830,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_se
do_add:
decl = OMP_CLAUSE_DECL (c);
- if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ if (error_operand_p (decl))
{
remove = true;
break;
@@ -5889,7 +5889,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_se
case OMP_CLAUSE_COPYIN:
case OMP_CLAUSE_COPYPRIVATE:
decl = OMP_CLAUSE_DECL (c);
- if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+ if (error_operand_p (decl))
{
remove = true;
break;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Move error_operand_p one level up
2011-06-10 10:08 [PATCH] Move error_operand_p one level up Paolo Carlini
@ 2011-06-10 10:51 ` Richard Guenther
2011-06-10 11:28 ` Paolo Carlini
0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2011-06-10 10:51 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches, Ian Lance Taylor, Jason Merrill
On Fri, Jun 10, 2011 at 11:58 AM, Paolo Carlini
<paolo.carlini@oracle.com> wrote:
> Hi,
>
> yesterday I noticed that, as I vaguely suspected for quite some time,
> error_operand_p can be useful also outside the c++ front-end. The below,
> which I bootstrapped c, c++, go, on x86_64-linux (and I'm finishing testing)
> tries to do that, moving the macro one level up and using it in all the
> suitable places I spotted.
>
> What do people think?
Ok if it bootstraps and tests.
Thanks,
Richard.
> Thanks,
> Paolo.
>
> ////////////////////
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Move error_operand_p one level up
2011-06-10 10:51 ` Richard Guenther
@ 2011-06-10 11:28 ` Paolo Carlini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Carlini @ 2011-06-10 11:28 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc-patches, Ian Lance Taylor, Jason Merrill
On 06/10/2011 12:14 PM, Richard Guenther wrote:
> On Fri, Jun 10, 2011 at 11:58 AM, Paolo Carlini
> <paolo.carlini@oracle.com> wrote:
>> Hi,
>>
>> yesterday I noticed that, as I vaguely suspected for quite some time,
>> error_operand_p can be useful also outside the c++ front-end. The below,
>> which I bootstrapped c, c++, go, on x86_64-linux (and I'm finishing testing)
>> tries to do that, moving the macro one level up and using it in all the
>> suitable places I spotted.
>>
>> What do people think?
> Ok if it bootstraps and tests.
Thanks Richard. I committed the gcc and gcc/cp changes, without touching
for the time being go/gofrontend, because I realized those files are
really mirrored from somewhere else. I leave those bits to Ian...
Paolo.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-10 11:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 10:08 [PATCH] Move error_operand_p one level up Paolo Carlini
2011-06-10 10:51 ` Richard Guenther
2011-06-10 11:28 ` Paolo Carlini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).