This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] Pretty print tweak


Hi,

I got annoyed with dumps like

      if (i > 999)
        {
          goto <ULe930>;
        }
      else
        {
          (void)0
        };

The empty "else" just clutters the dump IMHO.  With this patch the empty
COND_EXPR_ELSE is ignored if it is an empty statement:

      if (i > 999)
        {
          goto <ULe930>;
        };


Bootstrapped+regtested on i686-pc-linux-gnu, OK?

Gr.
Steven


2003-07-05  Steven Bosscher  <steven@gcc.gnu.org>

	* tree-pretty-print.c (dump_generic_node): Do not dump the
	else clause of a COND_EXPR if it is an empty statmement.


Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-pretty-print.c,v
retrieving revision 1.1.2.31
diff -c -3 -p -r1.1.2.31 tree-pretty-print.c
*** tree-pretty-print.c	1 Jul 2003 04:04:31 -0000	1.1.2.31
--- tree-pretty-print.c	5 Jul 2003 13:18:27 -0000
*************** dump_generic_node (buffer, node, spc, fl
*** 711,718 ****
  		  output_add_character (buffer, '}');
  		}
  
! 	      /* Output COND_EXPR_ELSE.  */
! 	      if (COND_EXPR_ELSE (node))
  		{
  		  newline_and_indent (buffer, spc);
  		  output_add_string (buffer, "else");
--- 711,720 ----
  		  output_add_character (buffer, '}');
  		}
  
! 	      /* Output COND_EXPR_ELSE, unless there only is
! 		 a dummy empty statement in it.  */
! 	      if (COND_EXPR_ELSE (node)
! 		  && !IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
  		{
  		  newline_and_indent (buffer, spc);
  		  output_add_string (buffer, "else");

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]