X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fpretty-print.h;h=bb1d156d31dd91b0de20f76d473cf33b155d5e36;hb=402f6a9e6b225e401135286881427884dad42680;hp=585b1d52101a1ec12058612fe1b07c29da881f05;hpb=8c4c00c181e6df4f0a9afc76e4c9edbbc1c2fd41;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index 585b1d52101..bb1d156d31d 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -1,5 +1,6 @@ /* Various declarations for language-independent pretty-print subroutines. - Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. Contributed by Gabriel Dos Reis This file is part of GCC. @@ -35,6 +36,7 @@ typedef struct va_list *args_ptr; int err_no; /* for %m */ location_t *locus; + void **x_data; } text_info; /* How often diagnostics are prefixed by their locations: @@ -70,9 +72,9 @@ struct chunk_info /* The output buffer datatype. This is best seen as an abstract datatype whose fields should not be accessed directly by clients. */ -typedef struct +typedef struct { - /* Obstack where the text is built up. */ + /* Obstack where the text is built up. */ struct obstack formatted_obstack; /* Obstack containing a chunked representation of the format @@ -89,7 +91,7 @@ typedef struct /* Where to output formatted text. */ FILE *stream; - /* The amount of characters output so far. */ + /* The amount of characters output so far. */ int line_length; /* This must be large enough to hold any printed integer or @@ -113,7 +115,7 @@ typedef struct diagnostic_prefixing_rule_t rule; /* The ideal upper bound of number of characters per line, as suggested - by front-end. */ + by front-end. */ int line_cutoff; } pp_wrapping_mode_t; @@ -139,14 +141,18 @@ typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *, /* TRUE if a newline character needs to be added before further formatting. */ -#define pp_needs_newline(PP) pp_base (PP)->need_newline +#define pp_needs_newline(PP) pp_base (PP)->need_newline -/* True if PRETTY-PTINTER is in line-wrapping mode. */ +/* True if PRETTY-PRINTER is in line-wrapping mode. */ #define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0) /* The amount of whitespace to be emitted when starting a new line. */ #define pp_indentation(PP) pp_base (PP)->indent_skip +/* True if identifiers are translated to the locale character set on + output. */ +#define pp_translate_identifiers(PP) pp_base (PP)->translate_identifiers + /* The data structure that contains the bare minimum required to do proper pretty-printing. Clients may derived from this structure and add additional fields they need. */ @@ -157,12 +163,12 @@ struct pretty_print_info /* The prefix for each new line. */ const char *prefix; - + /* Where to put whitespace around the entity being formatted. */ pp_padding padding; - + /* The real upper bound of number of characters per line, taking into - account the case of a very very looong prefix. */ + account the case of a very very looong prefix. */ int maximum_length; /* Indentation count. */ @@ -186,6 +192,10 @@ struct pretty_print_info /* Nonzero means one should emit a newline before outputting anything. */ bool need_newline; + + /* Nonzero means identifiers are translated to the locale character + set on output. */ + bool translate_identifiers; }; #define pp_set_line_maximum_length(PP, L) \ @@ -266,20 +276,17 @@ struct pretty_print_info } \ while (0) #define pp_decimal_int(PP, I) pp_scalar (PP, "%d", I) +#define pp_unsigned_wide_integer(PP, I) \ + pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I) #define pp_wide_integer(PP, I) \ pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I) #define pp_widest_integer(PP, I) \ pp_scalar (PP, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) I) #define pp_pointer(PP, P) pp_scalar (PP, "%p", P) -#define pp_identifier(PP, ID) pp_string (PP, ID) -#define pp_tree_identifier(PP, T) \ - pp_append_text(PP, IDENTIFIER_POINTER (T), \ - IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T)) - -#define pp_unsupported_tree(PP, T) \ - pp_verbatim (pp_base (PP), "#%qs not supported by %s#", \ - tree_code_name[(int) TREE_CODE (T)], __FUNCTION__) +#define pp_identifier(PP, ID) pp_string (PP, (pp_translate_identifiers (PP) \ + ? identifier_to_locale (ID) \ + : (ID))) #define pp_buffer(PP) pp_base (PP)->buffer @@ -298,10 +305,18 @@ extern const char *pp_base_last_position_in_text (const pretty_printer *); extern void pp_base_emit_prefix (pretty_printer *); extern void pp_base_append_text (pretty_printer *, const char *, const char *); -/* This header may be included before toplev.h, hence the duplicate +/* If we haven't already defined a front-end-specific diagnostics + style, use the generic one. */ +#ifdef GCC_DIAG_STYLE +#define GCC_PPDIAG_STYLE GCC_DIAG_STYLE +#else +#define GCC_PPDIAG_STYLE __gcc_diag__ +#endif + +/* This header may be included before diagnostics-core.h, hence the duplicate definitions to allow for GCC-specific formats. */ #if GCC_VERSION >= 3005 -#define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (__gcc_diag__, m ,n))) ATTRIBUTE_NONNULL(m) +#define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m) #else #define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m) #endif @@ -333,4 +348,8 @@ pp_set_verbatim_wrapping_ (pretty_printer *pp) } #define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (pp_base (PP)) +extern const char *identifier_to_locale (const char *); +extern void *(*identifier_to_locale_alloc) (size_t); +extern void (*identifier_to_locale_free) (void *); + #endif /* GCC_PRETTY_PRINT_H */