? o Index: c-format.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/c-family/c-format.c,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 c-format.c --- c-format.c 1 Mar 2014 08:43:01 -0000 1.1.1.1 +++ c-format.c 21 Aug 2015 10:27:56 -0000 @@ -867,7 +867,13 @@ static const format_kind_info format_typ strfmon_flag_specs, strfmon_flag_pairs, FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0, NULL, NULL - } + }, + { "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 + }, }; /* This layer of indirection allows GCC to reassign format_types with @@ -1983,6 +1989,13 @@ check_format_info_main (format_check_res warning (OPT_Wformat_, "conversion lacks type at end of format"); continue; } + + if (format_char == 'm' && !(fki->flags & FMT_FLAG_M_OK)) + { + warning (OPT_Wformat_, "%%m is not only allowed in syslog(3)"); + continue; + } + format_chars++; fci = fki->conversion_specs; while (fci->format_chars != 0 @@ -2854,6 +2867,7 @@ extern const target_ovr_attr TARGET_OVER static const target_ovr_attr gnu_target_overrides_format_attributes[] = { { "gnu_printf", "printf" }, + { "gnu_syslog", "syslog" }, { "gnu_scanf", "scanf" }, { "gnu_strftime", "strftime" }, { "gnu_strfmon", "strfmon" }, Index: c-format.h =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/c-family/c-format.h,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 c-format.h --- c-format.h 1 Mar 2014 08:43:01 -0000 1.1.1.1 +++ c-format.h 21 Aug 2015 10:27:57 -0000 @@ -75,11 +75,13 @@ enum FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128, /* The format arg is an opaque object that will be parsed by an external facility. */ - FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256 + FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256, /* Not included here: details of whether width or precision may occur (controlled by width_char and precision_char); details of whether '*' can be used for these (width_type and precision_type); details of whether length modifiers can occur (length_char_specs). */ + FMT_FLAG_M_OK = 512 + /* %m is only allowed in syslog */ }; /* Structure describing a length modifier supported in format checking, and