OSDN Git Service

2008-12-17 Sebastian Pop <sebastian.pop@amd.com>
[pf3gnuchains/gcc-fork.git] / gcc / pretty-print.c
index 2b04dc7..fdac10e 100644 (file)
@@ -50,7 +50,7 @@ along with GCC; see the file COPYING3.  If not see
         break;                                               \
                                                              \
       case 2:                                                \
-        pp_scalar (PP, "%ll" F, va_arg (ARG, long long T));  \
+        pp_scalar (PP, "%" HOST_LONG_LONG_FORMAT F, va_arg (ARG, long long T));  \
         break;                                               \
                                                              \
       default:                                               \
@@ -187,6 +187,7 @@ pp_base_indent (pretty_printer *pp)
    %Ns: likewise, but length specified as constant in the format string.
    %H: location_t.
    %J: a decl tree, from which DECL_SOURCE_LOCATION will be recorded.
+   %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
    Flag 'q': quote formatted text (must come immediately after '%').
 
    Arguments can be used sequentially, or through %N$ resp. *N$
@@ -486,6 +487,35 @@ pp_base_format (pretty_printer *pp, text_info *text)
          }
          break;
 
+       case 'K':
+         {
+           tree t = va_arg (*text->args_ptr, tree), block;
+           gcc_assert (text->locus != NULL);
+           *text->locus = EXPR_LOCATION (t);
+           gcc_assert (text->abstract_origin != NULL);
+           block = TREE_BLOCK (t);
+           *text->abstract_origin = NULL;
+           while (block
+                  && TREE_CODE (block) == BLOCK
+                  && BLOCK_ABSTRACT_ORIGIN (block))
+             {
+               tree ao = BLOCK_ABSTRACT_ORIGIN (block);
+
+               while (TREE_CODE (ao) == BLOCK
+                      && BLOCK_ABSTRACT_ORIGIN (ao)
+                      && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
+                 ao = BLOCK_ABSTRACT_ORIGIN (ao);
+
+               if (TREE_CODE (ao) == FUNCTION_DECL)
+                 {
+                   *text->abstract_origin = block;
+                   break;
+                 }
+               block = BLOCK_SUPERCONTEXT (block);
+             }
+         }
+         break;
+
        case '.':
          {
            int n;
@@ -633,7 +663,7 @@ pp_base_destroy_prefix (pretty_printer *pp)
 {
   if (pp->prefix != NULL)
     {
-      free (CONST_CAST (pp->prefix));
+      free (CONST_CAST (char *, pp->prefix));
       pp->prefix = NULL;
     }
 }