From ede1a3872913df59f3a1f4299ec5f6c7706d3b7b Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 1 Jul 2004 09:52:33 +0100 Subject: re PR c/1027 (slightly misleading printf format warning) PR c/1027 * c-lang.c (c_initialize_diagnostics): Move from here ... * c-objc-common.c: ... to here. Include "c-pretty-print.h". (c_tree_printer): Use pretty-printer to format %T. * c-pretty-print.c (pp_c_specifier_qualifier_list): Include space before '*' if not C++. (pp_c_direct_abstract_declarator): Don't try to print array upper bound for flexible array members. * c-tree.h: Include "diagnostic.h". (c_initialize_diagnostics): Declare. * objc/objc-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTICS): Define. * c-format.c (format_type_warning): New function. Improve diagnostics for incorrect format argument types. (check_format_types): Use it. Add two parameters. Use the TYPE_MAIN_VARIANT of wanted_type. (check_format_info_main): Pass new parameters to check_format_types. (struct format_wanted_type): Update comment. testsuite: * gcc.dg/Wswitch-enum.c, gcc.dg/Wswitch.c, gcc.dg/format/branch-1.c, gcc.dg/format/diag-1.c, gcc.dg/format/multattr-3.c, gcc.dg/format/xopen-1.c: Update expected warning text. * gcc.dg/format/diag-2.c: New test. From-SVN: r83965 --- gcc/c-tree.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/c-tree.h') diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 4d99c40..2375302 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define GCC_C_TREE_H #include "c-common.h" +#include "diagnostic.h" /* struct lang_identifier is private to c-decl.c, but langhooks.c needs to know how big it is. This is sanity-checked in c-decl.c. */ @@ -204,6 +205,7 @@ extern tree c_objc_common_truthvalue_conversion (tree expr); extern void c_objc_common_finish_file (void); extern int defer_fn (tree); extern bool c_warn_unused_global_decl (tree); +extern void c_initialize_diagnostics (diagnostic_context *); #define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \ c_build_qualified_type ((TYPE), \ -- cgit v1.1