aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-format.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2002-05-03 21:17:57 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2002-05-03 21:17:57 +0100
commit5a3085c52322177de6a1896d9c5388898b9daa54 (patch)
tree26076b1ab9508d93bec2ead731ea7f5f933b8074 /gcc/c-format.c
parent0659e0e3df6a29122914540ea13e7373ec84ab8e (diff)
downloadgcc-5a3085c52322177de6a1896d9c5388898b9daa54.zip
gcc-5a3085c52322177de6a1896d9c5388898b9daa54.tar.gz
gcc-5a3085c52322177de6a1896d9c5388898b9daa54.tar.bz2
re PR c/6547 (misleading printf '$' format)
* c-format.c (check_format_info_main): Don't check for presence of parameter for * width until after operand number has been read, and only check for it if format parameters are available. Fixes PR c/6547. testsuite: * gcc.dg/format/xopen-2.c: New test. From-SVN: r53118
Diffstat (limited to 'gcc/c-format.c')
-rw-r--r--gcc/c-format.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/c-format.c b/gcc/c-format.c
index e5be439..470ccf7 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -1751,11 +1751,6 @@ check_format_info_main (status, res, info, format_chars, format_length,
/* "...a field width...may be indicated by an asterisk.
In this case, an int argument supplies the field width..." */
++format_chars;
- if (params == 0)
- {
- status_warning (status, "too few arguments for format");
- return;
- }
if (has_operand_number != 0)
{
int opnum;
@@ -1775,6 +1770,11 @@ check_format_info_main (status, res, info, format_chars, format_length,
}
if (info->first_arg_num != 0)
{
+ if (params == 0)
+ {
+ status_warning (status, "too few arguments for format");
+ return;
+ }
cur_param = TREE_VALUE (params);
if (has_operand_number <= 0)
{