From 631238ac3f50b42dd55e87cd8bea02c7fbec0f53 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 9 May 2017 02:47:14 +0000 Subject: PR translation/80280 - Missing closing quote (%>) c/semantics.c and c/c-typeck.c gcc/c-family/ChangeLog: PR translation/80280 * c-format.h (struct format_flag_spec): Add new member. (T89_T): New macro. * c-format.c (local_tree_type_node): New global. (printf_flag_specs, asm_fprintf_flag_spec): Initialize new data. (gcc_diag_flag_specs, scanf_flag_specs, strftime_flag_specs): Ditto. (strfmon_flag_specs): Likewise. (gcc_diag_char_table, gcc_cdiag_char_table): Split up specifiers with distinct quoting properties. (gcc_tdiag_char_table, gcc_cxxdiag_char_table): Same. (flag_chars_t::validate): Add argument and handle bad quoting. (check_format_info_main): Handle quoting problems. (init_dynamic_diag_info): Simplify. gcc/testsuite/ChangeLog: PR translation/80280 * gcc.dg/format/gcc_diag-10.c: New test. From-SVN: r247778 --- gcc/c-family/c-format.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gcc/c-family/c-format.h') diff --git a/gcc/c-family/c-format.h b/gcc/c-family/c-format.h index 13ca8ea..37fa382 100644 --- a/gcc/c-family/c-format.h +++ b/gcc/c-family/c-format.h @@ -151,7 +151,16 @@ struct format_char_info "W" if the argument is a pointer which is dereferenced and written into, "R" if the argument is a pointer which is dereferenced and read from, "i" for printf integer formats where the '0' flag is ignored with - precision, and "[" for the starting character of a scanf scanset. */ + precision, and "[" for the starting character of a scanf scanset, + "<" if the specifier introduces a quoted sequence (such as "%<"), + ">" if the specifier terminates a quoted sequence (such as "%>"), + "[" if the specifier introduces a color sequence (such as "%r"), + "]" if the specifier terminates a color sequence (such as "%R"), + "'" (single quote) if the specifier is expected to be quoted when + it appears outside a quoted sequence and unquoted otherwise (such + as the GCC internal printf format directive "%T"), and + "\"" (double quote) if the specifier is not expected to appear in + a quoted sequence (such as the GCC internal format directive "%K". */ const char *flags2; /* If this format conversion character consumes more than one argument, CHAIN points to information about the next argument. For later @@ -178,6 +187,8 @@ struct format_flag_spec /* Nonzero if the next character after this flag in the format should be skipped ('=' in strfmon), zero otherwise. */ int skip_next_char; + /* True if the flag introduces quoting (as in GCC's %qE). */ + bool quoting; /* The name to use for this flag in diagnostic messages. For example, N_("'0' flag"), N_("field width"). */ const char *name; @@ -287,6 +298,7 @@ struct format_kind_info #define T_UC &unsigned_char_type_node #define T99_UC { STD_C99, NULL, T_UC } #define T_V &void_type_node +#define T89_T { STD_C89, NULL, &local_tree_type_node } #define T89_V { STD_C89, NULL, T_V } #define T_W &wchar_type_node #define T94_W { STD_C94, "wchar_t", T_W } -- cgit v1.1