/* Subroutines common to both C and C++ pretty-printers.
- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "real.h"
+#include "fixed-value.h"
+#include "intl.h"
#include "c-pretty-print.h"
#include "c-tree.h"
#include "tree-iterator.h"
#include "diagnostic.h"
+/* Translate if being used for diagnostics, but not for dump files or
+ __PRETTY_FUNCTION. */
+#define M_(msgid) (pp_translate_identifiers (pp) ? _(msgid) : (msgid))
+
/* The pretty-printer code is primarily designed to closely follow
(GNU) C and C++ grammars. That is to be contrasted with spaghetti
codes we used to have in the past. Following a structured
logic in the C++ pretty-printer. */
if (p != NULL && (*p == '*' || *p == '&'))
pp_c_whitespace (pp);
- pp_c_identifier (pp, cv);
+ pp_c_ws_string (pp, cv);
}
/* Pretty-print T using the type-cast notation '( type-name )'. */
const
restrict -- C99
__restrict__ -- GNU C
- volatile */
+ address-space-qualifier -- GNU C
+ volatile
+
+ address-space-qualifier:
+ identifier -- GNU C */
void
pp_c_type_qualifier_list (c_pretty_printer *pp, tree t)
{
- int qualifiers;
+ int qualifiers;
+
+ if (!t || t == error_mark_node)
+ return;
if (!TYPE_P (t))
t = TREE_TYPE (t);
pp_c_cv_qualifier (pp, "volatile");
if (qualifiers & TYPE_QUAL_RESTRICT)
pp_c_cv_qualifier (pp, flag_isoc99 ? "restrict" : "__restrict__");
+
+ if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (t)))
+ {
+ const char *as = c_addr_space_name (TYPE_ADDR_SPACE (t));
+ pp_c_identifier (pp, as);
+ }
}
/* pointer:
switch (code)
{
case ERROR_MARK:
- pp_c_identifier (pp, "<type-error>");
+ pp_c_ws_string (pp, M_("<type-error>"));
break;
case IDENTIFIER_NODE:
case BOOLEAN_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
+ case FIXED_POINT_TYPE:
if (TYPE_NAME (t))
{
t = TYPE_NAME (t);
else
{
int prec = TYPE_PRECISION (t);
- t = c_common_type_for_mode (TYPE_MODE (t), TYPE_UNSIGNED (t));
+ if (ALL_FIXED_POINT_MODE_P (TYPE_MODE (t)))
+ t = c_common_type_for_mode (TYPE_MODE (t), TYPE_SATURATING (t));
+ else
+ t = c_common_type_for_mode (TYPE_MODE (t), TYPE_UNSIGNED (t));
if (TYPE_NAME (t))
{
pp_c_type_specifier (pp, t);
{
case INTEGER_TYPE:
pp_string (pp, (TYPE_UNSIGNED (t)
- ? "<unnamed-unsigned:"
- : "<unnamed-signed:"));
+ ? M_("<unnamed-unsigned:")
+ : M_("<unnamed-signed:")));
break;
case REAL_TYPE:
- pp_string (pp, "<unnamed-float:");
+ pp_string (pp, M_("<unnamed-float:"));
+ break;
+ case FIXED_POINT_TYPE:
+ pp_string (pp, M_("<unnamed-fixed:"));
break;
default:
gcc_unreachable ();
if (DECL_NAME (t))
pp_id_expression (pp, t);
else
- pp_c_identifier (pp, "<typedef-error>");
+ pp_c_ws_string (pp, M_("<typedef-error>"));
break;
case UNION_TYPE:
case RECORD_TYPE:
case ENUMERAL_TYPE:
if (code == UNION_TYPE)
- pp_c_identifier (pp, "union");
+ pp_c_ws_string (pp, "union");
else if (code == RECORD_TYPE)
- pp_c_identifier (pp, "struct");
+ pp_c_ws_string (pp, "struct");
else if (code == ENUMERAL_TYPE)
- pp_c_identifier (pp, "enum");
+ pp_c_ws_string (pp, "enum");
else
- pp_c_identifier (pp, "<tag-error>");
+ pp_c_ws_string (pp, M_("<tag-error>"));
if (TYPE_NAME (t))
pp_id_expression (pp, TYPE_NAME (t));
else
- pp_c_identifier (pp, "<anonymous>");
+ pp_c_ws_string (pp, M_("<anonymous>"));
break;
default:
case VECTOR_TYPE:
case COMPLEX_TYPE:
- pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
if (code == COMPLEX_TYPE)
- pp_c_identifier (pp, flag_isoc99 ? "_Complex" : "__complex__");
+ pp_c_ws_string (pp, flag_isoc99 ? "_Complex" : "__complex__");
else if (code == VECTOR_TYPE)
- pp_c_identifier (pp, "__vector__");
+ {
+ pp_c_ws_string (pp, "__vector");
+ pp_c_left_paren (pp);
+ pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (t));
+ pp_c_right_paren (pp);
+ pp_c_whitespace (pp);
+ }
+ pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
break;
default:
tree parms = want_parm_decl ? DECL_ARGUMENTS (t) : TYPE_ARG_TYPES (t);
pp_c_left_paren (pp);
if (parms == void_list_node)
- pp_c_identifier (pp, "void");
+ pp_c_ws_string (pp, "void");
else
{
bool first = true;
if (host_integerp (maxval, 0))
pp_wide_integer (pp, tree_low_cst (maxval, 0) + 1);
else
- pp_expression (pp, fold (build2 (PLUS_EXPR, type, maxval,
- build_int_cst (type, 1))));
+ pp_expression (pp, fold_build2 (PLUS_EXPR, type, maxval,
+ build_int_cst (type, 1)));
}
pp_c_right_bracket (pp);
pp_direct_abstract_declarator (pp, TREE_TYPE (t));
case BOOLEAN_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
+ case FIXED_POINT_TYPE:
case ENUMERAL_TYPE:
case RECORD_TYPE:
case UNION_TYPE:
pp_c_storage_class_specifier (c_pretty_printer *pp, tree t)
{
if (TREE_CODE (t) == TYPE_DECL)
- pp_c_identifier (pp, "typedef");
+ pp_c_ws_string (pp, "typedef");
else if (DECL_P (t))
{
if (DECL_REGISTER (t))
- pp_c_identifier (pp, "register");
+ pp_c_ws_string (pp, "register");
else if (TREE_STATIC (t) && TREE_CODE (t) == VAR_DECL)
- pp_c_identifier (pp, "static");
+ pp_c_ws_string (pp, "static");
}
}
pp_c_function_specifier (c_pretty_printer *pp, tree t)
{
if (TREE_CODE (t) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (t))
- pp_c_identifier (pp, "inline");
+ pp_c_ws_string (pp, "inline");
}
/* declaration-specifiers:
case INTEGER_TYPE:
case REAL_TYPE:
+ case FIXED_POINT_TYPE:
case ENUMERAL_TYPE:
case UNION_TYPE:
case RECORD_TYPE:
{
case INTEGER_TYPE:
case REAL_TYPE:
+ case FIXED_POINT_TYPE:
case ENUMERAL_TYPE:
case UNION_TYPE:
case RECORD_TYPE:
if (attributes == NULL_TREE)
return;
- pp_c_identifier (pp, "__attribute__");
+ pp_c_ws_string (pp, "__attribute__");
pp_c_left_paren (pp);
pp_c_left_paren (pp);
for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes))
high = ~high + !low;
low = -low;
}
- sprintf (pp_buffer (pp)->digit_buffer,
- HOST_WIDE_INT_PRINT_DOUBLE_HEX, high, low);
+ sprintf (pp_buffer (pp)->digit_buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+ (unsigned HOST_WIDE_INT) high, (unsigned HOST_WIDE_INT) low);
pp_string (pp, pp_buffer (pp)->digit_buffer);
}
if (TYPE_UNSIGNED (type))
if (b == boolean_false_node)
{
if (c_dialect_cxx ())
- pp_c_identifier (pp, "false");
+ pp_c_ws_string (pp, "false");
else if (flag_isoc99)
- pp_c_identifier (pp, "_False");
+ pp_c_ws_string (pp, "_False");
else
pp_unsupported_tree (pp, b);
}
else if (b == boolean_true_node)
{
if (c_dialect_cxx ())
- pp_c_identifier (pp, "true");
+ pp_c_ws_string (pp, "true");
else if (flag_isoc99)
- pp_c_identifier (pp, "_True");
+ pp_c_ws_string (pp, "_True");
else
pp_unsupported_tree (pp, b);
}
pp_string (pp, "df");
}
+/* Print out a FIXED value as a decimal-floating-constant. */
+
+static void
+pp_c_fixed_constant (c_pretty_printer *pp, tree r)
+{
+ fixed_to_decimal (pp_buffer (pp)->digit_buffer, &TREE_FIXED_CST (r),
+ sizeof (pp_buffer (pp)->digit_buffer));
+ pp_string (pp, pp_buffer(pp)->digit_buffer);
+}
+
/* Pretty-print a compound literal expression. GNU extensions include
vector constants. */
}
}
+/* Pretty-print a COMPLEX_EXPR expression. */
+
+static void
+pp_c_complex_expr (c_pretty_printer *pp, tree e)
+{
+ /* Handle a few common special cases, otherwise fallback
+ to printing it as compound literal. */
+ tree type = TREE_TYPE (e);
+ tree realexpr = TREE_OPERAND (e, 0);
+ tree imagexpr = TREE_OPERAND (e, 1);
+
+ /* Cast of an COMPLEX_TYPE expression to a different COMPLEX_TYPE. */
+ if (TREE_CODE (realexpr) == NOP_EXPR
+ && TREE_CODE (imagexpr) == NOP_EXPR
+ && TREE_TYPE (realexpr) == TREE_TYPE (type)
+ && TREE_TYPE (imagexpr) == TREE_TYPE (type)
+ && TREE_CODE (TREE_OPERAND (realexpr, 0)) == REALPART_EXPR
+ && TREE_CODE (TREE_OPERAND (imagexpr, 0)) == IMAGPART_EXPR
+ && TREE_OPERAND (TREE_OPERAND (realexpr, 0), 0)
+ == TREE_OPERAND (TREE_OPERAND (imagexpr, 0), 0))
+ {
+ pp_c_type_cast (pp, type);
+ pp_expression (pp, TREE_OPERAND (TREE_OPERAND (realexpr, 0), 0));
+ return;
+ }
+
+ /* Cast of an scalar expression to COMPLEX_TYPE. */
+ if ((integer_zerop (imagexpr) || real_zerop (imagexpr))
+ && TREE_TYPE (realexpr) == TREE_TYPE (type))
+ {
+ pp_c_type_cast (pp, type);
+ if (TREE_CODE (realexpr) == NOP_EXPR)
+ realexpr = TREE_OPERAND (realexpr, 0);
+ pp_expression (pp, realexpr);
+ return;
+ }
+
+ pp_c_compound_literal (pp, e);
+}
+
/* constant:
integer-constant
floating-constant
+ fixed-point-constant
enumeration-constant
character-constant */
pp_c_floating_constant (pp, e);
break;
+ case FIXED_CST:
+ pp_c_fixed_constant (pp, e);
+ break;
+
case STRING_CST:
pp_c_string_literal (pp, e);
break;
+ case COMPLEX_CST:
+ /* Sometimes, we are confused and we think a complex literal
+ is a constant. Such thing is a compound literal which
+ grammatically belongs to postfix-expr production. */
+ pp_c_compound_literal (pp, e);
+ break;
+
default:
pp_unsupported_tree (pp, e);
break;
}
}
-/* Pretty-print an IDENTIFIER_NODE, preceded by whitespace is necessary. */
+/* Pretty-print a string such as an identifier, without changing its
+ encoding, preceded by whitespace is necessary. */
+
+void
+pp_c_ws_string (c_pretty_printer *pp, const char *str)
+{
+ pp_c_maybe_whitespace (pp);
+ pp_string (pp, str);
+ pp_base (pp)->padding = pp_before;
+}
+
+/* Pretty-print an IDENTIFIER_NODE, which may contain UTF-8 sequences
+ that need converting to the locale encoding, preceded by whitespace
+ is necessary. */
void
pp_c_identifier (c_pretty_printer *pp, const char *id)
break;
case ERROR_MARK:
- pp_c_identifier (pp, "<erroneous-expression>");
+ pp_c_ws_string (pp, M_("<erroneous-expression>"));
break;
case RESULT_DECL:
- pp_c_identifier (pp, "<return-value>");
+ pp_c_ws_string (pp, M_("<return-value>"));
break;
case INTEGER_CST:
case REAL_CST:
+ case FIXED_CST:
case STRING_CST:
pp_c_constant (pp, e);
break;
case TARGET_EXPR:
- pp_c_identifier (pp, "__builtin_memcpy");
+ pp_c_ws_string (pp, "__builtin_memcpy");
pp_c_left_paren (pp);
pp_ampersand (pp);
pp_primary_expression (pp, TREE_OPERAND (e, 0));
break;
default:
- /* FIXME: Make sure we won't get into an infinie loop. */
+ /* FIXME: Make sure we won't get into an infinite loop. */
pp_c_left_paren (pp);
pp_expression (pp, e);
pp_c_right_paren (pp);
tree type = TREE_TYPE (e);
const enum tree_code code = TREE_CODE (type);
+ if (TREE_CODE (e) == CONSTRUCTOR)
+ {
+ pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
+ return;
+ }
+
switch (code)
{
case RECORD_TYPE:
case VECTOR_TYPE:
if (TREE_CODE (e) == VECTOR_CST)
pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e));
- else if (TREE_CODE (e) == CONSTRUCTOR)
- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
else
break;
return;
case COMPLEX_TYPE:
- if (TREE_CODE (e) == CONSTRUCTOR)
- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
- else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
+ if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
{
const bool cst = TREE_CODE (e) == COMPLEX_CST;
pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0));
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
pp_postfix_expression (pp, TREE_OPERAND (e, 0));
- pp_identifier (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
+ pp_string (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
break;
case ARRAY_REF:
break;
case CALL_EXPR:
- pp_postfix_expression (pp, TREE_OPERAND (e, 0));
- pp_c_call_argument_list (pp, TREE_OPERAND (e, 1));
- break;
+ {
+ call_expr_arg_iterator iter;
+ tree arg;
+ pp_postfix_expression (pp, CALL_EXPR_FN (e));
+ pp_c_left_paren (pp);
+ FOR_EACH_CALL_EXPR_ARG (arg, iter, e)
+ {
+ pp_expression (pp, arg);
+ if (more_call_expr_args_p (&iter))
+ pp_separate_with (pp, ',');
+ }
+ pp_c_right_paren (pp);
+ break;
+ }
case UNORDERED_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "isunordered"
: "__builtin_isunordered");
goto two_args_fun;
case ORDERED_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isunordered"
: "!__builtin_isunordered");
goto two_args_fun;
case UNLT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isgreaterequal"
: "!__builtin_isgreaterequal");
goto two_args_fun;
case UNLE_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isgreater"
: "!__builtin_isgreater");
goto two_args_fun;
case UNGT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!islessequal"
: "!__builtin_islessequal");
goto two_args_fun;
case UNGE_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isless"
: "!__builtin_isless");
goto two_args_fun;
case UNEQ_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!islessgreater"
: "!__builtin_islessgreater");
goto two_args_fun;
case LTGT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "islessgreater"
: "__builtin_islessgreater");
goto two_args_fun;
break;
case ABS_EXPR:
- pp_c_identifier (pp, "__builtin_abs");
+ pp_c_ws_string (pp, "__builtin_abs");
pp_c_left_paren (pp);
pp_expression (pp, TREE_OPERAND (e, 0));
pp_c_right_paren (pp);
}
break;
+ case BIT_FIELD_REF:
+ {
+ tree type = TREE_TYPE (e);
+
+ type = signed_or_unsigned_type_for (TYPE_UNSIGNED (type), type);
+ if (type
+ && tree_int_cst_equal (TYPE_SIZE (type), TREE_OPERAND (e, 1)))
+ {
+ HOST_WIDE_INT bitpos = tree_low_cst (TREE_OPERAND (e, 2), 0);
+ HOST_WIDE_INT size = tree_low_cst (TYPE_SIZE (type), 0);
+ if ((bitpos % size) == 0)
+ {
+ pp_c_left_paren (pp);
+ pp_c_left_paren (pp);
+ pp_type_id (pp, type);
+ pp_c_star (pp);
+ pp_c_right_paren (pp);
+ pp_c_ampersand (pp);
+ pp_expression (pp, TREE_OPERAND (e, 0));
+ pp_c_right_paren (pp);
+ pp_c_left_bracket (pp);
+ pp_wide_integer (pp, bitpos / size);
+ pp_c_right_bracket (pp);
+ break;
+ }
+ }
+ pp_unsupported_tree (pp, e);
+ }
+ break;
+
case COMPLEX_CST:
case VECTOR_CST:
- case COMPLEX_EXPR:
pp_c_compound_literal (pp, e);
break;
+ case COMPLEX_EXPR:
+ pp_c_complex_expr (pp, e);
+ break;
+
case COMPOUND_LITERAL_EXPR:
e = DECL_INITIAL (COMPOUND_LITERAL_EXPR_DECL (e));
/* Fall through. */
break;
case VA_ARG_EXPR:
- pp_c_identifier (pp, "__builtin_va_arg");
+ pp_c_ws_string (pp, "__builtin_va_arg");
pp_c_left_paren (pp);
pp_assignment_expression (pp, TREE_OPERAND (e, 0));
pp_separate_with (pp, ',');
}
}
-/* Print out an expression-list in parens, as in a function call. */
+/* Print out an expression-list in parens, as if it were the argument
+ list to a function. */
void
pp_c_call_argument_list (c_pretty_printer *pp, tree t)
{
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
- pp_identifier (pp, code == PREINCREMENT_EXPR ? "++" : "--");
+ pp_string (pp, code == PREINCREMENT_EXPR ? "++" : "--");
pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
break;
case REALPART_EXPR:
case IMAGPART_EXPR:
- pp_c_identifier (pp, code == REALPART_EXPR ? "__real__" : "__imag__");
+ pp_c_ws_string (pp, code == REALPART_EXPR ? "__real__" : "__imag__");
pp_c_whitespace (pp);
pp_unary_expression (pp, TREE_OPERAND (e, 0));
break;
{
case FLOAT_EXPR:
case FIX_TRUNC_EXPR:
- case CONVERT_EXPR:
- case NOP_EXPR:
+ CASE_CONVERT:
+ case VIEW_CONVERT_EXPR:
pp_c_type_cast (pp, TREE_TYPE (e));
pp_c_cast_expression (pp, TREE_OPERAND (e, 0));
break;
enum tree_code code = TREE_CODE (e);
switch (code)
{
+ case POINTER_PLUS_EXPR:
case PLUS_EXPR:
case MINUS_EXPR:
pp_c_additive_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- if (code == PLUS_EXPR)
+ if (code == PLUS_EXPR || code == POINTER_PLUS_EXPR)
pp_plus (pp);
else
pp_minus (pp);
case RSHIFT_EXPR:
pp_c_shift_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, code == LSHIFT_EXPR ? "<<" : ">>");
+ pp_string (pp, code == LSHIFT_EXPR ? "<<" : ">>");
pp_c_whitespace (pp);
pp_c_additive_expression (pp, TREE_OPERAND (e, 1));
break;
else if (code == GT_EXPR)
pp_greater (pp);
else if (code == LE_EXPR)
- pp_identifier (pp, "<=");
+ pp_string (pp, "<=");
else if (code == GE_EXPR)
- pp_identifier (pp, ">=");
+ pp_string (pp, ">=");
pp_c_whitespace (pp);
pp_c_shift_expression (pp, TREE_OPERAND (e, 1));
break;
case NE_EXPR:
pp_c_equality_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, code == EQ_EXPR ? "==" : "!=");
+ pp_string (pp, code == EQ_EXPR ? "==" : "!=");
pp_c_whitespace (pp);
pp_c_relational_expression (pp, TREE_OPERAND (e, 1));
break;
static void
pp_c_exclusive_or_expression (c_pretty_printer *pp, tree e)
{
- if (TREE_CODE (e) == BIT_XOR_EXPR)
+ if (TREE_CODE (e) == BIT_XOR_EXPR
+ || TREE_CODE (e) == TRUTH_XOR_EXPR)
{
pp_c_exclusive_or_expression (pp, TREE_OPERAND (e, 0));
- pp_c_maybe_whitespace (pp);
+ if (TREE_CODE (e) == BIT_XOR_EXPR)
+ pp_c_maybe_whitespace (pp);
+ else
+ pp_c_whitespace (pp);
pp_carret (pp);
pp_c_whitespace (pp);
pp_c_and_expression (pp, TREE_OPERAND (e, 1));
static void
pp_c_logical_and_expression (c_pretty_printer *pp, tree e)
{
- if (TREE_CODE (e) == TRUTH_ANDIF_EXPR)
+ if (TREE_CODE (e) == TRUTH_ANDIF_EXPR
+ || TREE_CODE (e) == TRUTH_AND_EXPR)
{
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, "&&");
+ pp_string (pp, "&&");
pp_c_whitespace (pp);
pp_c_inclusive_or_expression (pp, TREE_OPERAND (e, 1));
}
void
pp_c_logical_or_expression (c_pretty_printer *pp, tree e)
{
- if (TREE_CODE (e) == TRUTH_ORIF_EXPR)
+ if (TREE_CODE (e) == TRUTH_ORIF_EXPR
+ || TREE_CODE (e) == TRUTH_OR_EXPR)
{
pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, "||");
+ pp_string (pp, "||");
pp_c_whitespace (pp);
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 1));
}
static void
pp_c_assignment_expression (c_pretty_printer *pp, tree e)
{
- if (TREE_CODE (e) == MODIFY_EXPR
- || TREE_CODE (e) == GIMPLE_MODIFY_STMT
+ if (TREE_CODE (e) == MODIFY_EXPR
|| TREE_CODE (e) == INIT_EXPR)
{
- pp_c_unary_expression (pp, GENERIC_TREE_OPERAND (e, 0));
+ pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
pp_equal (pp);
pp_space (pp);
- pp_c_expression (pp, GENERIC_TREE_OPERAND (e, 1));
+ pp_c_expression (pp, TREE_OPERAND (e, 1));
}
else
pp_c_conditional_expression (pp, e);
pp_c_floating_constant (pp, e);
break;
+ case FIXED_CST:
+ pp_c_fixed_constant (pp, e);
+ break;
+
case STRING_CST:
pp_c_string_literal (pp, e);
break;
case ARRAY_REF:
case CALL_EXPR:
case COMPONENT_REF:
+ case BIT_FIELD_REF:
case COMPLEX_CST:
case COMPLEX_EXPR:
case VECTOR_CST:
case FLOAT_EXPR:
case FIX_TRUNC_EXPR:
- case CONVERT_EXPR:
- case NOP_EXPR:
+ CASE_CONVERT:
+ case VIEW_CONVERT_EXPR:
pp_c_cast_expression (pp, e);
break;
break;
case BIT_XOR_EXPR:
+ case TRUTH_XOR_EXPR:
pp_c_exclusive_or_expression (pp, e);
break;
break;
case TRUTH_ANDIF_EXPR:
+ case TRUTH_AND_EXPR:
pp_c_logical_and_expression (pp, e);
break;
case TRUTH_ORIF_EXPR:
+ case TRUTH_OR_EXPR:
pp_c_logical_or_expression (pp, e);
break;
pp_conditional_expression (pp, e);
break;
+ case POINTER_PLUS_EXPR:
case PLUS_EXPR:
case MINUS_EXPR:
pp_c_additive_expression (pp, e);
break;
case MODIFY_EXPR:
- case GIMPLE_MODIFY_STMT:
case INIT_EXPR:
pp_assignment_expression (pp, e);
break;
pp_postfix_expression (pp, TREE_OPERAND (e, 1));
break;
+ case BIND_EXPR:
+ case GOTO_EXPR:
+ /* We don't yet have a way of dumping statements in a
+ human-readable format. */
+ pp_string (pp, "({...})");
+ break;
+
default:
pp_unsupported_tree (pp, e);
break;
else
{
static char xname[8];
- sprintf (xname, "<U%4x>", ((unsigned)((unsigned long)(t) & 0xffff)));
+ sprintf (xname, "<U%4x>", ((unsigned)((uintptr_t)(t) & 0xffff)));
name = xname;
}