/* Various declarations for language-independent diagnostics subroutines.
- Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
This file is part of GCC.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
#ifndef GCC_DIAGNOSTIC_H
#define GCC_DIAGNOSTIC_H
/* Constants used to discriminate diagnostics. */
typedef enum
{
-#define DEFINE_DIAGNOSTIC_KIND(K, M) K,
+#define DEFINE_DIAGNOSTIC_KIND(K, msgid) K,
#include "diagnostic.def"
#undef DEFINE_DIAGNOSTIC_KIND
DK_LAST_DIAGNOSTIC_KIND
location_t location;
/* The kind of diagnostic it is about. */
diagnostic_t kind;
+ /* Which OPT_* directly controls this diagnostic. */
+ int option_index;
} diagnostic_info;
#define pedantic_error_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
the context of a diagnostic message. */
struct diagnostic_context
{
- /* Where most of the diagnostic formatting work is done. */
+ /* Where most of the diagnostic formatting work is done. */
pretty_printer *printer;
/* The number of times we have issued diagnostics. */
/* True if we should display the "warnings are being tread as error"
message, usually displayed once per compiler run. */
- bool warnings_are_errors_message;
+ bool issue_warnings_are_errors_message;
+
+ /* True if it has been requested that warnings be treated as errors. */
+ bool warning_as_error_requested;
+
+ /* True if we should print the command line option which controls
+ each diagnostic, if known. */
+ bool show_option_requested;
/* True if we should raise a SIGABRT on errors. */
bool abort_on_error;
int last_module;
int lock;
-
- /* Hook for front-end extensions. */
- void *x_data;
};
/* Client supplied function to announce a diagnostic. */
#define diagnostic_auxiliary_data(DC) (DC)->x_data
/* Same as pp_format_decoder. Works on 'diagnostic_context *'. */
-#define diagnostic_format_decoder(DC) pp_format_decoder ((DC)->printer)
+#define diagnostic_format_decoder(DC) ((DC)->printer->format_decoder)
/* Same as output_prefixing_rule. Works on 'diagnostic_context *'. */
-#define diagnostic_prefixing_rule(DC) ((DC)->printer->prefixing_rule)
+#define diagnostic_prefixing_rule(DC) ((DC)->printer->wrapping.rule)
/* Maximum characters per line in automatic line wrapping mode.
Zero means don't wrap lines. */
-#define diagnostic_line_cutoff(DC) ((DC)->printer->ideal_maximum_length)
+#define diagnostic_line_cutoff(DC) ((DC)->printer->wrapping.line_cutoff)
-#define diagnostic_flush_buffer(DC) pp_flush ((DC)->printer)
+#define diagnostic_flush_buffer(DC) pp_base_flush ((DC)->printer)
/* True if the last function in which a diagnostic was reported is
different from the current one. */
extern char *diagnostic_build_prefix (diagnostic_info *);
/* Pure text formatting support functions. */
-extern void verbatim (const char *, ...);
extern char *file_name_as_prefix (const char *);
+/* In tree-pretty-print.c */
+extern int dump_generic_node (pretty_printer *, tree, int, int, bool);
+extern void print_generic_stmt (FILE *, tree, int);
+extern void print_generic_stmt_indented (FILE *, tree, int, int);
+extern void print_generic_expr (FILE *, tree, int);
+extern void print_generic_decl (FILE *, tree, int);
+
+extern void debug_generic_expr (tree);
+extern void debug_generic_stmt (tree);
+extern void debug_c_tree (tree);
#endif /* ! GCC_DIAGNOSTIC_H */