? o Index: c-format.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc.old/dist/gcc/c-family/c-format.c,v retrieving revision 1.4 diff -u -u -r1.4 c-format.c --- c-format.c 23 Jul 2017 01:10:59 -0000 1.4 +++ c-format.c 11 Sep 2018 18:27:00 -0000 @@ -823,70 +823,70 @@ printf_flag_specs, printf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, 'w', 0, 'p', 0, 'L', 0, - &integer_type_node, &integer_type_node + &integer_type_node, &integer_type_node, format_type_error }, { "asm_fprintf", asm_fprintf_length_specs, asm_fprintf_char_table, " +#0-", NULL, asm_fprintf_flag_specs, asm_fprintf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, 'w', 0, 'p', 0, 'L', 0, - NULL, NULL + NULL, NULL, format_type_error }, { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+#", NULL, gcc_diag_flag_specs, gcc_diag_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+#", NULL, gcc_tdiag_flag_specs, gcc_tdiag_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+#", NULL, gcc_cdiag_flag_specs, gcc_cdiag_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_cxxdiag", gcc_cxxdiag_length_specs, gcc_cxxdiag_char_table, "q+#", NULL, gcc_cxxdiag_flag_specs, gcc_cxxdiag_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 'p', 0, 'L', 0, - NULL, &integer_type_node + NULL, &integer_type_node, format_type_error }, { "gcc_gfc", gcc_gfc_length_specs, gcc_gfc_char_table, "q+#", NULL, gcc_gfc_flag_specs, gcc_gfc_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK, 0, 0, 0, 0, 0, 0, - NULL, NULL + NULL, NULL, format_type_error }, { "NSString", NULL, NULL, NULL, NULL, NULL, NULL, FMT_FLAG_ARG_CONVERT|FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL, 0, 0, 0, 0, 0, 0, - NULL, NULL + NULL, NULL, format_type_error }, { "gnu_scanf", scanf_length_specs, scan_char_table, "*'I", NULL, scanf_flag_specs, scanf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK, 'w', 0, 0, '*', 'L', 'm', - NULL, NULL + NULL, NULL, format_type_error }, { "gnu_strftime", NULL, time_char_table, "_-0^#", "EO", strftime_flag_specs, strftime_flag_pairs, FMT_FLAG_FANCY_PERCENT_OK|FMT_FLAG_M_OK, 'w', 0, 0, 0, 0, 0, - NULL, NULL + NULL, NULL, format_type_error }, { "gnu_strfmon", strfmon_length_specs, monetary_char_table, "=^+(!-", NULL, strfmon_flag_specs, strfmon_flag_pairs, FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0, - NULL, NULL + NULL, NULL, format_type_error }, { "gnu_syslog", printf_length_specs, print_char_table, " +#0-'I", NULL, printf_flag_specs, printf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_M_OK, 'w', 0, 'p', 0, 'L', 0, - &integer_type_node, &integer_type_node + &integer_type_node, &integer_type_node, printf_format_type }, }; @@ -1033,18 +1033,22 @@ params = tree_cons (NULL_TREE, argarray[i], params); check_format_info (&info, params); } + format_kind_info *fi = &format_types[info.format_type]; if (warn_suggest_attribute_format && info.first_arg_num == 0 - && (format_types[info.format_type].flags - & (int) FMT_FLAG_ARG_CONVERT)) + && (fi->flags & (int) FMT_FLAG_ARG_CONVERT)) { tree c; for (c = TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)); c; c = TREE_CHAIN (c)) - if (is_attribute_p ("format", TREE_PURPOSE (c)) - && (decode_format_type (IDENTIFIER_POINTER - (TREE_VALUE (TREE_VALUE (c)))) - == info.format_type)) + if (!is_attribute_p ("format", TREE_PURPOSE (c))) + continue; + int format_type = decode_format_type ( + IDENTIFIER_POINTER (TREE_VALUE (TREE_VALUE (c)))); + if (format_type == format_type_error) + continue; + if (format_type == info.format_type || + format_type == fi->parent_format_type) break; if (c == NULL_TREE) { @@ -1065,7 +1069,7 @@ if (args != 0) warning (OPT_Wsuggest_attribute_format, "function might " "be possible candidate for %qs format attribute", - format_types[info.format_type].name); + fi->name); } } } Index: c-format.h =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc.old/dist/gcc/c-family/c-format.h,v retrieving revision 1.4 diff -u -u -r1.4 c-format.h --- c-format.h 23 Jul 2017 01:10:59 -0000 1.4 +++ c-format.h 11 Sep 2018 18:27:00 -0000 @@ -253,6 +253,8 @@ /* Pointer to type of argument expected if '*' is used for a precision, or NULL if '*' not used for precisions. */ tree *precision_type; + /* A format type that is a subset of our format */ + int parent_format_type; } format_kind_info; #define T_I &integer_type_node