* [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
@ 2004-06-12 17:38 Steven Bosscher
2004-06-12 18:40 ` Jason Merrill
0 siblings, 1 reply; 9+ messages in thread
From: Steven Bosscher @ 2004-06-12 17:38 UTC (permalink / raw)
To: gcc-patches
Hi,
The only correct uses of TREE_COMPLEXITY can be avoided by using
TREE_NO_WARNING.
The other uses appear to be relics from past times.
Bootstrapped and tested on x86_64-unknown-linux-gnu. OK?
Gr.
Steven
* c-common.c (c_common_truthvalue_conversion): Don't warn if
TREE_NO_WARNING is set.
cp/
* cp-tree.h (C_SET_EXP_ORIGINAL_CODE): Remove.
* decl.c (grokdeclarator): Ignore TREE_COMPLEXITY, it's never
set anywhere.
* decl2.c (grokfield): Likewise.
* semantics.c (finish_parenthesized_expr): Don't set
C_EXPR_ORIGINAL_CODE to avoid a warning. Use TREE_NO_WARNING
instead.
* tree.c (build_min_nt, build_min, build_min_nop_dep): Don't
set TREE_COMPLEXITY.
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.511
diff -c -3 -p -r1.511 c-common.c
*** c-common.c 10 Jun 2004 08:07:44 -0000 1.511
--- c-common.c 12 Jun 2004 12:22:08 -0000
*************** c_common_truthvalue_conversion (tree exp
*** 2745,2751 ****
break;
case MODIFY_EXPR:
! if (warn_parentheses && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR)
warning ("suggest parentheses around assignment used as truth value");
break;
--- 2745,2753 ----
break;
case MODIFY_EXPR:
! if (warn_parentheses
! && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR
! && !TREE_NO_WARNING (expr))
warning ("suggest parentheses around assignment used as truth value");
break;
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.974
diff -c -3 -p -r1.974 cp-tree.h
*** cp/cp-tree.h 7 Jun 2004 02:10:55 -0000 1.974
--- cp/cp-tree.h 12 Jun 2004 12:22:08 -0000
*************** typedef enum cp_id_kind
*** 421,430 ****
#define C_TYPE_FIELDS_READONLY(TYPE) \
(LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
- /* Store a value in that field. */
- #define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
- (TREE_COMPLEXITY (EXP) = (int)(CODE))
-
/* The tokens stored in the default argument. */
#define DEFARG_TOKENS(NODE) \
--- 421,426 ----
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1213
diff -c -3 -p -r1.1213 decl.c
*** cp/decl.c 10 Jun 2004 08:08:00 -0000 1.1213
--- cp/decl.c 12 Jun 2004 12:22:09 -0000
*************** grokdeclarator (tree declarator,
*** 6560,6567 ****
}
else if (ctype == NULL_TREE)
ctype = cname;
- else if (TREE_COMPLEXITY (decl) == current_class_depth)
- ;
else
{
if (! UNIQUELY_DERIVED_FROM_P (cname, ctype))
--- 6560,6565 ----
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.713
diff -c -3 -p -r1.713 decl2.c
*** cp/decl2.c 3 Jun 2004 23:15:01 -0000 1.713
--- cp/decl2.c 12 Jun 2004 12:22:09 -0000
*************** grokfield (tree declarator, tree declspe
*** 850,863 ****
if (declspecs == NULL_TREE
&& TREE_CODE (declarator) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE)
! {
! /* Access declaration */
! if (! IS_AGGR_TYPE_CODE (TREE_CODE (TREE_OPERAND (declarator, 0))))
! ;
! else if (TREE_COMPLEXITY (declarator) == current_class_depth)
! pop_nested_class ();
! return do_class_using_decl (declarator);
! }
if (init
&& TREE_CODE (init) == TREE_LIST
--- 850,857 ----
if (declspecs == NULL_TREE
&& TREE_CODE (declarator) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE)
! /* Access declaration */
! return do_class_using_decl (declarator);
if (init
&& TREE_CODE (init) == TREE_LIST
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.396
diff -c -3 -p -r1.396 semantics.c
*** cp/semantics.c 13 May 2004 06:40:22 -0000 1.396
--- cp/semantics.c 12 Jun 2004 12:22:09 -0000
*************** finish_parenthesized_expr (tree expr)
*** 1135,1141 ****
{
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
/* This inhibits warnings in c_common_truthvalue_conversion. */
! C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK);
if (TREE_CODE (expr) == OFFSET_REF)
/* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
--- 1135,1141 ----
{
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
/* This inhibits warnings in c_common_truthvalue_conversion. */
! TREE_NO_WARNING (expr) = 1;
if (TREE_CODE (expr) == OFFSET_REF)
/* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.376
diff -c -3 -p -r1.376 tree.c
*** cp/tree.c 2 Jun 2004 21:12:54 -0000 1.376
--- cp/tree.c 12 Jun 2004 12:22:10 -0000
*************** build_min_nt (enum tree_code code, ...)
*** 1298,1304 ****
t = make_node (code);
length = TREE_CODE_LENGTH (code);
- TREE_COMPLEXITY (t) = input_line;
for (i = 0; i < length; i++)
{
--- 1298,1303 ----
*************** build_min (enum tree_code code, tree tt,
*** 1325,1331 ****
t = make_node (code);
length = TREE_CODE_LENGTH (code);
TREE_TYPE (t) = tt;
- TREE_COMPLEXITY (t) = input_line;
for (i = 0; i < length; i++)
{
--- 1324,1329 ----
*************** build_min_non_dep (enum tree_code code,
*** 1356,1362 ****
t = make_node (code);
length = TREE_CODE_LENGTH (code);
TREE_TYPE (t) = TREE_TYPE (non_dep);
- TREE_COMPLEXITY (t) = input_line;
TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (non_dep);
for (i = 0; i < length; i++)
--- 1354,1359 ----
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
2004-06-12 17:38 [C++] Remove uses of TREE_COMPLEXITY from the C++ front end Steven Bosscher
@ 2004-06-12 18:40 ` Jason Merrill
2004-06-12 19:00 ` Steven Bosscher
0 siblings, 1 reply; 9+ messages in thread
From: Jason Merrill @ 2004-06-12 18:40 UTC (permalink / raw)
To: Steven Bosscher; +Cc: gcc-patches
On Sat, 12 Jun 2004 16:51:12 +0200, Steven Bosscher <stevenb@suse.de> wrote:
> The only correct uses of TREE_COMPLEXITY can be avoided by using
> TREE_NO_WARNING.
I don't see the point in trying to remove C_EXP_ORIGINAL_CODE from the C++
front end until it's removed from the C front end, too.
> The other uses appear to be relics from past times.
The other changes are OK.
Jason
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
2004-06-12 18:40 ` Jason Merrill
@ 2004-06-12 19:00 ` Steven Bosscher
2004-06-14 0:06 ` Jason Merrill
2004-06-15 21:28 ` Joseph S. Myers
0 siblings, 2 replies; 9+ messages in thread
From: Steven Bosscher @ 2004-06-12 19:00 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches
On Saturday 12 June 2004 17:40, Jason Merrill wrote:
> On Sat, 12 Jun 2004 16:51:12 +0200, Steven Bosscher <stevenb@suse.de> wrote:
> > The only correct uses of TREE_COMPLEXITY can be avoided by using
> > TREE_NO_WARNING.
>
> I don't see the point in trying to remove C_EXP_ORIGINAL_CODE from the C++
> front end until it's removed from the C front end, too.
The whole point is to remove it from the C front end eventually.
I plan to do this by using a tree annotation for that, ie. some
mechanism to allow the front ends to use tree annotations (but
other suggestions are welcome).
This would also allow TREE_COMPLEXITY to be removed from C and
Ada, and hence from struc tree_exp.
Gr.
Steven
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
2004-06-12 19:00 ` Steven Bosscher
@ 2004-06-14 0:06 ` Jason Merrill
2004-06-14 11:26 ` Zack Weinberg
2004-06-15 21:28 ` Joseph S. Myers
1 sibling, 1 reply; 9+ messages in thread
From: Jason Merrill @ 2004-06-14 0:06 UTC (permalink / raw)
To: Steven Bosscher; +Cc: gcc-patches
On Sat, 12 Jun 2004 17:43:03 +0200, Steven Bosscher <s.bosscher@student.tudelft.nl> wrote:
> On Saturday 12 June 2004 17:40, Jason Merrill wrote:
>> On Sat, 12 Jun 2004 16:51:12 +0200, Steven Bosscher <stevenb@suse.de> wrote:
>> > The only correct uses of TREE_COMPLEXITY can be avoided by using
>> > TREE_NO_WARNING.
>>
>> I don't see the point in trying to remove C_EXP_ORIGINAL_CODE from the C++
>> front end until it's removed from the C front end, too.
>
> The whole point is to remove it from the C front end eventually.
Please remove it from both front ends at the same time.
Jason
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
2004-06-14 0:06 ` Jason Merrill
@ 2004-06-14 11:26 ` Zack Weinberg
2004-06-14 17:22 ` Jason Merrill
0 siblings, 1 reply; 9+ messages in thread
From: Zack Weinberg @ 2004-06-14 11:26 UTC (permalink / raw)
To: Jason Merrill; +Cc: Steven Bosscher, gcc-patches
Jason Merrill <jason@redhat.com> writes:
>>> I don't see the point in trying to remove C_EXP_ORIGINAL_CODE from the C++
>>> front end until it's removed from the C front end, too.
>>
>> The whole point is to remove it from the C front end eventually.
>
> Please remove it from both front ends at the same time.
This is exactly the kind of patch that's best done as a series of
incremental changes. I don't see why you are objecting to this
method.
zw
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
2004-06-14 11:26 ` Zack Weinberg
@ 2004-06-14 17:22 ` Jason Merrill
2004-06-14 18:39 ` Joseph S. Myers
0 siblings, 1 reply; 9+ messages in thread
From: Jason Merrill @ 2004-06-14 17:22 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Steven Bosscher, gcc-patches
On Sun, 13 Jun 2004 23:44:11 -0700, Zack Weinberg <zack@codesourcery.com> wrote:
> Jason Merrill <jason@redhat.com> writes:
>
>>>> I don't see the point in trying to remove C_EXP_ORIGINAL_CODE from the C++
>>>> front end until it's removed from the C front end, too.
>>>
>>> The whole point is to remove it from the C front end eventually.
>>
>> Please remove it from both front ends at the same time.
>
> This is exactly the kind of patch that's best done as a series of
> incremental changes. I don't see why you are objecting to this method.
I'm not objecting to incremental changes in general; I already approved the
other pieces of the patch. But C_EXP_ORIGINAL_CODE is used in the same way
by both front ends. I don't see the point in changing two places in the
C++ front end to use a separate mechanism while the C front end is still
using the old one. I object to patches that cause the C and C++ front ends
to diverge. In most cases I have to suck it up because people aren't
interested in doing the necessary work for parallel changes, but in this
case I don't see any good reason for the divergence.
Jason
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
2004-06-14 17:22 ` Jason Merrill
@ 2004-06-14 18:39 ` Joseph S. Myers
0 siblings, 0 replies; 9+ messages in thread
From: Joseph S. Myers @ 2004-06-14 18:39 UTC (permalink / raw)
To: Jason Merrill; +Cc: Zack Weinberg, Steven Bosscher, gcc-patches
On Mon, 14 Jun 2004, Jason Merrill wrote:
> I'm not objecting to incremental changes in general; I already approved the
> other pieces of the patch. But C_EXP_ORIGINAL_CODE is used in the same way
> by both front ends. I don't see the point in changing two places in the
Since the C++ front end doesn't provide the -Wparentheses warnings other
than this one in common code (that for ambiguous else is also in common
code, but unrelated to C_EXP_ORIGINAL_CODE and doesn't seem to be provided
by the C++ front end), I don't think there's really much in common between
the uses in the two front ends.
--
Joseph S. Myers
jsm@polyomino.org.uk
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
2004-06-12 19:00 ` Steven Bosscher
2004-06-14 0:06 ` Jason Merrill
@ 2004-06-15 21:28 ` Joseph S. Myers
1 sibling, 0 replies; 9+ messages in thread
From: Joseph S. Myers @ 2004-06-15 21:28 UTC (permalink / raw)
To: Steven Bosscher; +Cc: Jason Merrill, gcc-patches
On Sat, 12 Jun 2004, Steven Bosscher wrote:
> The whole point is to remove it from the C front end eventually.
> I plan to do this by using a tree annotation for that, ie. some
> mechanism to allow the front ends to use tree annotations (but
> other suggestions are welcome).
I have a proposal for keeping this sort of information in separate
structures outside the trees altogether discussed in comment #15 to bug
14711 (and something similar proposed by Roger Sayle in
<http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00332.html>) and slightly
expanded at <http://www.srcf.ucam.org/~jsm28/gcc/#parsestruct> but won't
object to use of tree annotations to provide at least an interim fix
(presuming they do provide the desired memory savings from getting rid of
this complexity field) that avoids the need for more wide-ranging
front-end changes of more general use.
--
Joseph S. Myers
jsm@polyomino.org.uk
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [C++] Remove uses of TREE_COMPLEXITY from the C++ front end
@ 2004-06-12 19:46 Richard Kenner
0 siblings, 0 replies; 9+ messages in thread
From: Richard Kenner @ 2004-06-12 19:46 UTC (permalink / raw)
To: s.bosscher; +Cc: gcc-patches
This would also allow TREE_COMPLEXITY to be removed from C and
Ada, and hence from struc tree_exp.
It's dead in Ada now.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-06-15 19:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-12 17:38 [C++] Remove uses of TREE_COMPLEXITY from the C++ front end Steven Bosscher
2004-06-12 18:40 ` Jason Merrill
2004-06-12 19:00 ` Steven Bosscher
2004-06-14 0:06 ` Jason Merrill
2004-06-14 11:26 ` Zack Weinberg
2004-06-14 17:22 ` Jason Merrill
2004-06-14 18:39 ` Joseph S. Myers
2004-06-15 21:28 ` Joseph S. Myers
2004-06-12 19:46 Richard Kenner
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).