From 0bc9c2526844e064f4f032d0de56164a7c44581f Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sat, 14 Aug 1993 03:22:24 +0000 Subject: [PATCH] (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 --- gcc/c-typeck.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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) -- 2.30.2