From 49706e39a2b65519ef173e55637c41c899e0b968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Fri, 4 Jun 2010 15:15:38 +0000 Subject: re PR c/25880 (improve message of warning for discarding qualifiers) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2010-06-04 Manuel López-Ibáñez PR c/25880 * c-objc-common.c (c_tree_printer): Handle %V, %v and %#v. * c-format.c (gcc_diag_flag_specs): Add hash. (gcc_cxxdiag_flag_specs): Use gcc_diag_flag_specs directly. (gcc_tdiag_char_table,gcc_cdiag_char_table): Handle %V and %v. * c-pretty-print.c (pp_c_cv_qualifier): Rename as pp_c_cv_qualifiers. Handle qualifiers spelling here. (pp_c_type_qualifier_list): Call the function above. * c-pretty-print.h (pp_c_cv_qualifiers): Declare. * c-typeck.c (handle_warn_cast_qual): Print qualifiers. (WARN_FOR_QUALIFIERS): New macro. (convert_for_assignment): Use it. testsuite/ * gcc.dg/assign-warn-2.c: Update. * gcc.dg/cpp/line3.c: Update. * gcc.dg/c99-array-lval-8.c: Update. * gcc.dg/cast-qual-2.c: Update. * gcc.dg/c99-arraydecl-3.c: Update. * gcc.dg/assign-warn-1.c: Update. * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r160274 --- gcc/c-format.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'gcc/c-format.c') diff --git a/gcc/c-format.c b/gcc/c-format.c index 0522d29..2c73ead 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -421,6 +421,7 @@ static const format_flag_pair gcc_gfc_flag_pairs[] = static const format_flag_spec gcc_diag_flag_specs[] = { { '+', 0, 0, N_("'+' flag"), N_("the '+' printf flag"), STD_C89 }, + { '#', 0, 0, N_("'#' flag"), N_("the '#' printf flag"), STD_C89 }, { 'q', 0, 0, N_("'q' flag"), N_("the 'q' diagnostic flag"), STD_C89 }, { 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 }, { 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 }, @@ -429,16 +430,7 @@ static const format_flag_spec gcc_diag_flag_specs[] = #define gcc_tdiag_flag_specs gcc_diag_flag_specs #define gcc_cdiag_flag_specs gcc_diag_flag_specs - -static const format_flag_spec gcc_cxxdiag_flag_specs[] = -{ - { '+', 0, 0, N_("'+' flag"), N_("the '+' printf flag"), STD_C89 }, - { '#', 0, 0, N_("'#' flag"), N_("the '#' printf flag"), STD_C89 }, - { 'q', 0, 0, N_("'q' flag"), N_("the 'q' diagnostic flag"), STD_C89 }, - { 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 }, - { 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 }, - { 0, 0, 0, NULL, NULL, STD_C89 } -}; +#define gcc_cxxdiag_flag_specs gcc_diag_flag_specs static const format_flag_spec scanf_flag_specs[] = { @@ -585,7 +577,9 @@ static const format_char_info gcc_tdiag_char_table[] = /* Custom conversion specifiers. */ /* These will require a "tree" at runtime. */ - { "DFKTE", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL }, + { "DFKTEV", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL }, + + { "v", 0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q#", "", NULL }, { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL }, { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL }, @@ -605,7 +599,9 @@ static const format_char_info gcc_cdiag_char_table[] = /* Custom conversion specifiers. */ /* These will require a "tree" at runtime. */ - { "DEFKT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL }, + { "DEFKTV", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL }, + + { "v", 0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q#", "", NULL }, { "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL }, { "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL }, @@ -627,6 +623,8 @@ static const format_char_info gcc_cxxdiag_char_table[] = /* These will require a "tree" at runtime. */ { "ADEFKTV",0,STD_C89,{ T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+#", "", NULL }, + { "v", 0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q#", "", NULL }, + /* These accept either an 'int' or an 'enum tree_code' (which is handled as an 'int'.) */ { "CLOPQ",0,STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, @@ -722,19 +720,19 @@ static const format_kind_info format_types_orig[] = 'w', 0, 'p', 0, 'L', 0, NULL, NULL }, - { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+", NULL, + { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+#", NULL, gcc_diag_flag_specs, gcc_diag_flag_pairs, FMT_FLAG_ARG_CONVERT, 0, 0, 'p', 0, 'L', 0, NULL, &integer_type_node }, - { "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+", NULL, + { "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+#", NULL, gcc_tdiag_flag_specs, gcc_tdiag_flag_pairs, FMT_FLAG_ARG_CONVERT, 0, 0, 'p', 0, 'L', 0, NULL, &integer_type_node }, - { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+", NULL, + { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+#", NULL, gcc_cdiag_flag_specs, gcc_cdiag_flag_pairs, FMT_FLAG_ARG_CONVERT, 0, 0, 'p', 0, 'L', 0, -- cgit v1.1