/* Various declarations for language-independent pretty-print subroutines.
- Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
<http://www.gnu.org/licenses/>. */
#include "config.h"
-#undef FLOAT /* This is for hpux. They should change hpux. */
-#undef FFS /* Some systems define this in param.h. */
#include "system.h"
#include "coretypes.h"
#include "intl.h"
#include "pretty-print.h"
-#include "tree.h"
#include "ggc.h"
#if HAVE_ICONV
%.*s: a substring the length of which is specified by an argument
integer.
%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$
this point. */
memset (formatters, 0, sizeof formatters);
-
+
for (p = text->format_spec; *p; )
{
while (*p != '\0' && *p != '%')
{
case '\0':
gcc_unreachable ();
-
+
case '%':
obstack_1grow (&buffer->chunk_obstack, '%');
p++;
gcc_assert (chunk < PP_NL_ARGMAX * 2);
args[chunk++] = XOBFINISH (&buffer->chunk_obstack, const char *);
args[chunk] = 0;
-
+
/* Set output to the argument obstack, and switch line-wrapping and
prefixing off. */
buffer->obstack = &buffer->chunk_obstack;
(pp, *text->args_ptr, precision, unsigned, "x");
break;
- case 'H':
- {
- location_t *locus = va_arg (*text->args_ptr, location_t *);
- gcc_assert (text->locus != NULL);
- *text->locus = *locus;
- }
- break;
-
- case 'J':
- {
- tree t = va_arg (*text->args_ptr, tree);
- gcc_assert (text->locus != NULL);
- *text->locus = DECL_SOURCE_LOCATION (t);
- }
- 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;
pp_base (pp)->padding = pp_none;
}
}
-
-/* Print the identifier ID to PRETTY-PRINTER. */
-
-void
-pp_base_tree_identifier (pretty_printer *pp, tree id)
-{
- if (pp_translate_identifiers (pp))
- {
- const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
- pp_append_text (pp, text, text + strlen (text));
- }
- else
- pp_append_text (pp, IDENTIFIER_POINTER (id),
- IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
-}
\f
/* The string starting at P has LEN (at least 1) bytes left; if they
start with a valid UTF-8 sequence, return the length of that