This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for X/Open %n$ format checking, and more testcases
- To: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Subject: Re: Patch for X/Open %n$ format checking, and more testcases
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 21 Aug 2000 13:27:40 -0600
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <Pine.LNX.4.21.0008211938240.8305-100000@kern.srcf.societies.cam.a
c.uk>you write:
> This patch fixes the support for X/Open $ operand number formats (%n$
> meaning to use the nth argument, and *n$ similarly for width and
> precision) to work properly (previously only supported for printf %n$,
> not for scanf or width or precision) and to follow the X/Open specs.
> $ formats cannot be mixed with non-$ ones, except for those formats
> (%% and scanf %*) that do not use arguments. There must not be gaps
> in the numbers of the arguments selected by the format (since the
> implementation wouldn't know in such a case what types to pass to
> va_arg).
>
> It also fixes a bug in the checking of vprintf formats with precision
> '*', and adds some additional testcases (mostly not relating to the
> patch but simply providing more thorough testing of format checking).
> With the patch applied, all these added tests pass except for the
> xfails for lack of intmax_t.
>
> Bootstrapped with no regressions on i686-pc-linux-gnu. OK to commit?
>
> gcc/ChangeLog:
> 2000-08-21 Joseph S. Myers <jsm28@cam.ac.uk>
>
> * c-common.c (init_dollar_format_checking,
> maybe_read_dollar_number, finish_dollar_format_checking): New
> functions.
> (dollar_arguments_used, dollar_arguments_count,
> dollar_first_arg_num, dollar_max_arg_used, dollar_format_warned):
> New variables.
> (check_format_info): Support $ formats for scanf and printf width
> and precision. Always increment format_chars to advance past the
> '*' of precision, not just when the format parameters are
> available to check.
>
> gcc/testsuite/ChangeLog:
> 2000-08-21 Joseph S. Myers <jsm28@cam.ac.uk>
>
> * gcc.dg/c90-printf-3.c, gcc.dg/c90-scanf-2.c,
> gcc.dg/c90-scanf-3.c, gcc.dg/c90-scanf-4.c,
> gcc.dg/c90-strftime-1.c, gcc.dg/c99-printf-3.c,
> gcc.dg/c99-scanf-1.c, gcc.dg/c99-scanf-2.c, gcc.dg/c99-scanf-3.c,
> gcc.dg/format-xopen-1.c: New tests.
This is fine. Please install this patch.
jeff