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]

[ast-optimizer-branch] PATCH to c-pretty-print float<->intconversions


These qualify as casts, too.

2002-06-10  Jason Merrill  <jason@redhat.com>

	* c-pretty-print.c (dump_c_node): Print FIX_TRUNC_EXPR, FLOAT_EXPR
	et al as casts.  Add parens as needed.

*** c-pretty-print.c.~1~	Mon Jun 10 10:57:11 2002
--- c-pretty-print.c	Mon Jun 10 08:43:00 2002
*************** dump_c_node (buffer, node, spc)
*** 718,731 ****
        }
        break;
  
-     case FIX_TRUNC_EXPR:
-     case FIX_CEIL_EXPR:
-     case FIX_FLOOR_EXPR:
-     case FIX_ROUND_EXPR:
-     case FLOAT_EXPR:
-       dump_c_node (buffer, TREE_OPERAND (node, 0), spc);	  
-       break;
- 
        /* Unary arithmetic and logic expressions.  */
      case NEGATE_EXPR:
      case BIT_NOT_EXPR:
--- 718,723 ----
*************** dump_c_node (buffer, node, spc)
*** 817,832 ****
      case RANGE_EXPR:
        NIY;
  
      case CONVERT_EXPR:
      case NOP_EXPR:
        type = TREE_TYPE (node);
!       if (type != TREE_TYPE (TREE_OPERAND (node, 0)))
  	{
  	  output_add_character (buffer, '(');
  	  dump_c_node (buffer, type, spc);
  	  output_add_string (buffer, ")");
  	}
!       dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
        break;
  
      case NON_LVALUE_EXPR:
--- 809,834 ----
      case RANGE_EXPR:
        NIY;
  
+     case FIX_TRUNC_EXPR:
+     case FIX_CEIL_EXPR:
+     case FIX_FLOOR_EXPR:
+     case FIX_ROUND_EXPR:
+     case FLOAT_EXPR:
      case CONVERT_EXPR:
      case NOP_EXPR:
        type = TREE_TYPE (node);
!       op0 = TREE_OPERAND (node, 0);
!       if (type != TREE_TYPE (op0))
  	{
  	  output_add_character (buffer, '(');
  	  dump_c_node (buffer, type, spc);
  	  output_add_string (buffer, ")");
  	}
!       if (op_prio (op0) < op_prio (node))
! 	output_add_character (buffer, '(');
!       dump_c_node (buffer, op0, spc);
!       if (op_prio (op0) < op_prio (node))
! 	output_add_character (buffer, ')');
        break;
  
      case NON_LVALUE_EXPR:

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