diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2008-04-24 07:42:07 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@gcc.gnu.org> | 2008-04-24 07:42:07 +0000 |
commit | f9f9640f8464328726ca641a942366145504a7bd (patch) | |
tree | 1bf5ccf9dc81704b2e3222f660e2c18b7fdc33c0 /gcc/c-format.c | |
parent | 64ceac43df8d0b74914b438137f89c6afde0ef61 (diff) | |
download | gcc-f9f9640f8464328726ca641a942366145504a7bd.zip gcc-f9f9640f8464328726ca641a942366145504a7bd.tar.gz gcc-f9f9640f8464328726ca641a942366145504a7bd.tar.bz2 |
c-format.c (check_format_info_main): Use strncmp rather than a magic prefix to handle multichar length specs.
gcc
* c-format.c (check_format_info_main): Use strncmp rather than a magic prefix
to handle multichar length specs.
* config/i386/msformat-c.c (format_length_info ms_printf_length_specs):
Don't prefix "I64" and "I32" with '\0'.
testsuite
* gcc.dg/format/ms-warnI64-1.c: New file.
From-SVN: r134623
Diffstat (limited to 'gcc/c-format.c')
-rw-r--r-- | gcc/c-format.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/gcc/c-format.c b/gcc/c-format.c index d1a136f..82f5ff3 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -1779,26 +1779,12 @@ check_format_info_main (format_check_results *res, length_chars_std = STD_C89; if (fli) { - while (fli->name != 0 && fli->name[0] != *format_chars) - { - if (fli->name[0] == '\0') - { - int si = strlen (fli->name + 1) + 1; - int i = 1; - while (fli->name[i] != 0 && fli->name[i] == format_chars [i - 1]) - ++i; - if (si == i) - { - if (si > 2) - format_chars += si - 2; - break; - } - } + while (fli->name != 0 + && strncmp (fli->name, format_chars, strlen (fli->name))) fli++; - } if (fli->name != 0) { - format_chars++; + format_chars += strlen (fli->name); if (fli->double_name != 0 && fli->name[0] == *format_chars) { format_chars++; |