/* Various declarations for language-independent pretty-print subroutines.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
/* The prefix for each new line. */
const char *prefix;
-
- pp_flags flags;
/* Where to put whitespace around the entity being formatted. */
pp_padding padding;
#define pp_append_text(PP, B, E) \
pp_base_append_text (pp_base (PP), B, E)
#define pp_flush(PP) pp_base_flush (pp_base (PP))
+#define pp_prepare_to_format(PP, TI, LOC) \
+ pp_base_prepare_to_format (pp_base (PP), TI, LOC)
#define pp_format_text(PP, TI) pp_base_format_text (pp_base (PP), TI)
#define pp_format_verbatim(PP, TI) \
pp_base_format_verbatim (pp_base (PP), TI)
do { \
pp_indentation (PP) += N; \
pp_newline (PP); \
+ pp_base_indent (pp_base (PP)); \
+ pp_needs_newline (PP) = false; \
} while (0)
+#define pp_maybe_newline_and_indent(PP, N) \
+ if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
+#define pp_maybe_space(PP) pp_base_maybe_space (pp_base (PP))
#define pp_separate_with(PP, C) \
do { \
pp_character (PP, C); \
IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T))
#define pp_unsupported_tree(PP, T) \
- pp_verbatim (pp_base (PP), "#`%s' not supported by %s#", \
+ pp_verbatim (pp_base (PP), "#%qs not supported by %s#", \
tree_code_name[(int) TREE_CODE (T)], __FUNCTION__)
#define pp_buffer(PP) pp_base (PP)->buffer
/* Clients that directly derive from pretty_printer need to override
- this macro to return a pointer to the base pretty_printer structrure. */
+ this macro to return a pointer to the base pretty_printer structure. */
#define pp_base(PP) (PP)
extern void pp_construct (pretty_printer *, const char *, int);
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 *);
-extern void pp_printf (pretty_printer *, const char *, ...) ATTRIBUTE_PRINTF_2;
+
+/* This header may be included before toplev.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)
+#else
+#define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
+#endif
+extern void pp_printf (pretty_printer *, const char *, ...)
+ ATTRIBUTE_GCC_PPDIAG(2,3);
+
extern void pp_verbatim (pretty_printer *, const char *, ...);
extern void pp_base_flush (pretty_printer *);
+extern void pp_base_prepare_to_format (pretty_printer *, text_info *,
+ location_t *);
extern void pp_base_format_text (pretty_printer *, text_info *);
extern void pp_base_format_verbatim (pretty_printer *, text_info *);
+extern void pp_base_indent (pretty_printer *);
extern void pp_base_newline (pretty_printer *);
extern void pp_base_character (pretty_printer *, int);
extern void pp_base_string (pretty_printer *, const char *);
+extern void pp_write_text_to_stream (pretty_printer *pp);
+extern void pp_base_maybe_space (pretty_printer *);
#endif /* GCC_PRETTY_PRINT_H */