FreeBSD/contrib/gcc/c-common.c
/* Given a boolean expression ARG, return a tree representing an increment
   or decrement (as indicated by CODE) of ARG.  The front end must check for
   invalid cases (e.g., decrement in C++).  */
Given a boolean expression ARG, return a tree representing an increment
or decrement (as indicated by CODE) of ARG.  The front end must check for
invalid cases .
Given a boolean expression ARG return a tree representing an increment or decrement ( as indicated by CODE ) of ARG . The front end must check for invalid cases .
tree
boolean_increment (enum tree_code code, tree arg)
{
  tree val;
  tree true_res = boolean_true_node;
  arg = stabilize_reference (arg);
  switch (code)
    {
    case PREINCREMENT_EXPR:
      val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, true_res);
      break;
    case POSTINCREMENT_EXPR:
      val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, true_res);
      arg = save_expr (arg);
      val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
      val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
      break;
    case PREDECREMENT_EXPR:
      val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg,
		    invert_truthvalue (arg));
      break;
    case POSTDECREMENT_EXPR:
      val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg,
		    invert_truthvalue (arg));
      arg = save_expr (arg);
      val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
      val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
      break;
    default:
      gcc_unreachable ();
    }
  TREE_SIDE_EFFECTS (val) = 1;
  return val;
}
tree boolean_increment ( enum tree_code code , tree arg ) { tree val ; tree true_res = boolean_true_node ; arg = stabilize_reference ( arg ) ; switch ( code ) { case PREINCREMENT_EXPR : val = build2 ( MODIFY_EXPR , TREE_TYPE ( arg ) , arg , true_res ) ; break ; case POSTINCREMENT_EXPR : val = build2 ( MODIFY_EXPR , TREE_TYPE ( arg ) , arg , true_res ) ; arg = save_expr ( arg ) ; val = build2 ( COMPOUND_EXPR , TREE_TYPE ( arg ) , val , arg ) ; val = build2 ( COMPOUND_EXPR , TREE_TYPE ( arg ) , arg , val ) ; break ; case PREDECREMENT_EXPR : val = build2 ( MODIFY_EXPR , TREE_TYPE ( arg ) , arg , invert_truthvalue ( arg ) ) ; break ; case POSTDECREMENT_EXPR : val = build2 ( MODIFY_EXPR , TREE_TYPE ( arg ) , arg , invert_truthvalue ( arg ) ) ; arg = save_expr ( arg ) ; val = build2 ( COMPOUND_EXPR , TREE_TYPE ( arg ) , val , arg ) ; val = build2 ( COMPOUND_EXPR , TREE_TYPE ( arg ) , arg , val ) ; break ; default : gcc_unreachable ( ) ; } TREE_SIDE_EFFECTS ( val ) = 1 ; return val ; }
Given a boolean expression ARG, return a tree representing an increment
or decrement (as indicated by CODE) of ARG.
Given a boolean expression ARG return a tree representing an increment or decrement ( as indicated by CODE ) of ARG .