Commit effa5541 by Joseph Myers Committed by Joseph Myers

c-common.c (format_char_info): Add 'W' flag to comment.

	* c-common.c (format_char_info): Add 'W' flag to comment.
	(print_char_table, scan_char_table): Use it.
	(check_format_info): Use the 'W' flag to determine whether a
	format argument is written into.

From-SVN: r36492
parent 65661a72
2000-09-18 Joseph S. Myers <jsm28@cam.ac.uk> 2000-09-18 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (format_char_info): Add 'W' flag to comment.
(print_char_table, scan_char_table): Use it.
(check_format_info): Use the 'W' flag to determine whether a
format argument is written into.
2000-09-18 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (check_format_types): Reorganise and clean up, * c-common.c (check_format_types): Reorganise and clean up,
checking earlier for ERROR_MARKs and making cur_type into its checking earlier for ERROR_MARKs and making cur_type into its
TYPE_MAIN_VARIANT where convenient. TYPE_MAIN_VARIANT where convenient.
......
...@@ -1299,8 +1299,9 @@ typedef struct ...@@ -1299,8 +1299,9 @@ typedef struct
"a" allocation extension (not applicable in C99 mode), "*" for "a" allocation extension (not applicable in C99 mode), "*" for
scanf suppression, "2" for strftime two digit year formats, "3" scanf suppression, "2" for strftime two digit year formats, "3"
for strftime formats giving two digit years in some locales, "E" for strftime formats giving two digit years in some locales, "E"
and "O" for those strftime modifiers, and "o" if use of strftime "O" and "O" for those strftime modifiers, "o" if use of strftime "O"
is a GNU extension beyond C99. */ is a GNU extension beyond C99, and "W" if the argument is a
pointer which is dereferenced and written into. */
const char *flag_chars; const char *flag_chars;
} format_char_info; } format_char_info;
...@@ -1444,7 +1445,7 @@ static const format_char_info print_char_table[] = ...@@ -1444,7 +1445,7 @@ static const format_char_info print_char_table[] =
{ "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w" }, { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w" },
{ "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wpc" }, { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wpc" },
{ "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wc" }, { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wc" },
{ "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T99_LL, BADLEN, T99_SST, T99_PD, T99_IM }, "" }, { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T99_LL, BADLEN, T99_SST, T99_PD, T99_IM }, "W" },
/* C99 conversion specifiers. */ /* C99 conversion specifiers. */
{ "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#'" }, { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#'" },
{ "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#" }, { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#" },
...@@ -1459,19 +1460,19 @@ static const format_char_info print_char_table[] = ...@@ -1459,19 +1460,19 @@ static const format_char_info print_char_table[] =
static const format_char_info scan_char_table[] = static const format_char_info scan_char_table[] =
{ {
/* C89 conversion specifiers. */ /* C89 conversion specifiers. */
{ "di", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T99_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "*w" }, { "di", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T99_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "*wW" },
{ "ouxX", 1, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T99_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "*w" }, { "ouxX", 1, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T99_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "*wW" },
{ "efgEG", 1, STD_C89, { T89_F, BADLEN, BADLEN, T89_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "*w" }, { "efgEG", 1, STD_C89, { T89_F, BADLEN, BADLEN, T89_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "*wW" },
{ "c", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*cw" }, { "c", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*cwW" },
{ "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*acw" }, { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*acwW" },
{ "[", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*acw" }, { "[", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*acwW" },
{ "p", 2, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w" }, { "p", 2, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*wW" },
{ "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T99_LL, BADLEN, T99_SST, T99_PD, T99_IM }, "" }, { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T99_LL, BADLEN, T99_SST, T99_PD, T99_IM }, "W" },
/* C99 conversion specifiers. */ /* C99 conversion specifiers. */
{ "FaA", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "*w" }, { "FaA", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "*wW" },
/* X/Open conversion specifiers. */ /* X/Open conversion specifiers. */
{ "C", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w" }, { "C", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*wW" },
{ "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*aw" }, { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*awW" },
{ NULL, 0, 0, NOLENGTHS, NULL } { NULL, 0, 0, NOLENGTHS, NULL }
}; };
...@@ -2482,9 +2483,7 @@ check_format_info (info, params) ...@@ -2482,9 +2483,7 @@ check_format_info (info, params)
if (index (fci->flag_chars, 'c') != 0) if (index (fci->flag_chars, 'c') != 0)
main_wanted_type.char_lenient_flag = 1; main_wanted_type.char_lenient_flag = 1;
main_wanted_type.writing_in_flag = 0; main_wanted_type.writing_in_flag = 0;
if (info->format_type == scanf_format_type if (index (fci->flag_chars, 'W') != 0)
|| (info->format_type == printf_format_type
&& format_char == 'n'))
main_wanted_type.writing_in_flag = 1; main_wanted_type.writing_in_flag = 1;
main_wanted_type.name = NULL; main_wanted_type.name = NULL;
main_wanted_type.param = cur_param; main_wanted_type.param = cur_param;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment