OSDN Git Service

Document LTO behavior with incompatible declarations.
[pf3gnuchains/gcc-fork.git] / gcc / c-pretty-print.c
index efd15ac..f94f2c9 100644 (file)
@@ -1,5 +1,5 @@
 /* Subroutines common to both C and C++ pretty-printers.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
    Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
 
@@ -23,14 +23,18 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "real.h"
-#include "fixed-value.h"
+#include "tree.h"
 #include "intl.h"
 #include "c-pretty-print.h"
+#include "tree-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
@@ -221,7 +225,11 @@ pp_c_space_for_pointer_operator (c_pretty_printer *pp, tree t)
        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)
@@ -241,6 +249,12 @@ pp_c_type_qualifier_list (c_pretty_printer *pp, tree 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:
@@ -307,7 +321,7 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
   switch (code)
     {
     case ERROR_MARK:
-      pp_c_ws_string (pp, _("<type-error>"));
+      pp_c_ws_string (pp, M_("<type-error>"));
       break;
 
     case IDENTIFIER_NODE:
@@ -346,14 +360,14 @@ pp_c_type_specifier (c_pretty_printer *pp, tree 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, _("<unnamed-fixed:"));
+                 pp_string (pp, M_("<unnamed-fixed:"));
                  break;
                default:
                  gcc_unreachable ();
@@ -368,7 +382,7 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
       if (DECL_NAME (t))
        pp_id_expression (pp, t);
       else
-       pp_c_ws_string (pp, _("<typedef-error>"));
+       pp_c_ws_string (pp, M_("<typedef-error>"));
       break;
 
     case UNION_TYPE:
@@ -381,12 +395,12 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
       else if (code == ENUMERAL_TYPE)
        pp_c_ws_string (pp, "enum");
       else
-       pp_c_ws_string (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_ws_string (pp, _("<anonymous>"));
+       pp_c_ws_string (pp, M_("<anonymous>"));
       break;
 
     default:
@@ -440,11 +454,17 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
 
     case VECTOR_TYPE:
     case COMPLEX_TYPE:
-      pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
       if (code == COMPLEX_TYPE)
        pp_c_ws_string (pp, flag_isoc99 ? "_Complex" : "__complex__");
       else if (code == VECTOR_TYPE)
-       pp_c_ws_string (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:
@@ -833,7 +853,7 @@ pp_c_integer_constant (c_pretty_printer *pp, tree i)
          high = ~high + !low;
          low = -low;
        }
-      sprintf (pp_buffer (pp)->digit_buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX, 
+      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);
     }
@@ -1119,11 +1139,11 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e)
       break;
 
     case ERROR_MARK:
-      pp_c_ws_string (pp, _("<erroneous-expression>"));
+      pp_c_ws_string (pp, M_("<erroneous-expression>"));
       break;
 
     case RESULT_DECL:
-      pp_c_ws_string (pp, _("<return-value>"));
+      pp_c_ws_string (pp, M_("<return-value>"));
       break;
 
     case INTEGER_CST:
@@ -1939,7 +1959,7 @@ pp_c_conditional_expression (c_pretty_printer *pp, tree e)
 static void
 pp_c_assignment_expression (c_pretty_printer *pp, tree e)
 {
-  if (TREE_CODE (e) == MODIFY_EXPR 
+  if (TREE_CODE (e) == MODIFY_EXPR
       || TREE_CODE (e) == INIT_EXPR)
     {
       pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
@@ -2231,7 +2251,7 @@ pp_c_tree_decl_identifier (c_pretty_printer *pp, tree t)
   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;
     }