From: Richard Stallman Date: Sat, 14 Aug 1993 03:22:24 +0000 (+0000) Subject: (check_format): For scan of "%["... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0bc9c2526844e064f4f032d0de56164a7c44581f;p=gcc.git (check_format): For scan of "%["... (check_format): For scan of "%[", skip over scan set til closing ']' to avoid processing it as ordinary format characters. From-SVN: r5160 --- diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2088f00f8e6..04799655bf1 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -1716,6 +1716,21 @@ check_format (info, params) format_char); warning (message); } + if (info->is_scan && format_char == '[') + { + /* Skip over scan set, in case it happens to have '%' in it. */ + if (*format_chars == '^') + ++format_chars; + /* Find closing bracket; if one is hit immediately, then + it's part of the scan set rather than a terminator. */ + if (*format_chars == ']') + ++format_chars; + while (*format_chars && *format_chars != ']') + ++format_chars; + if (*format_chars != ']') + /* The end of the format string was reached. */ + warning ("no closing `]' for `%%[' format"); + } if (suppressed) { if (index (fci->flag_chars, '*') == 0)