Commit d125d268 by Ulrich Drepper

(format_char_info): Update comment.

(format_char_info): Update comment.  (check_format_info): Recognize 'z'
modifier in the same way 'Z' was recognized.  Emit warning for formats
new in ISO C99 only if flag_isoc9x is not set.

From-SVN: r31188
parent 0bd209d9
...@@ -1195,7 +1195,7 @@ typedef struct { ...@@ -1195,7 +1195,7 @@ typedef struct {
/* Type of argument if length modifier `L' is used. /* Type of argument if length modifier `L' is used.
If NULL, then this modifier is not allowed. */ If NULL, then this modifier is not allowed. */
tree *bigllen; tree *bigllen;
/* Type of argument if length modifier `Z' is used. /* Type of argument if length modifiers 'z' or `Z' is used.
If NULL, then this modifier is not allowed. */ If NULL, then this modifier is not allowed. */
tree *zlen; tree *zlen;
/* List of other modifier characters allowed with these options. */ /* List of other modifier characters allowed with these options. */
...@@ -1250,7 +1250,7 @@ static format_char_info time_char_table[] = { ...@@ -1250,7 +1250,7 @@ static format_char_info time_char_table[] = {
{ "HIMSUWdemw", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow" }, { "HIMSUWdemw", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow" },
{ "Vju", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" }, { "Vju", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" },
{ "Gklsz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" }, { "Gklsz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" },
{ "ABZa", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" }, { "ABZza", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" },
{ "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" }, { "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" },
{ "bh", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^" }, { "bh", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^" },
{ "CY", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOw" }, { "CY", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOw" },
...@@ -1764,26 +1764,25 @@ check_format_info (info, params) ...@@ -1764,26 +1764,25 @@ check_format_info (info, params)
warning ("ANSI C does not support the `%c' length modifier", warning ("ANSI C does not support the `%c' length modifier",
length_char); length_char);
} }
else if (*format_chars == 'Z') else if (*format_chars == 'Z' || *format_chars == 'z')
{ {
length_char = *format_chars++; length_char = *format_chars++;
if (pedantic) if (pedantic && (length_char == 'Z' || !flag_isoc9x))
warning ("ANSI C does not support the `Z' length modifier"); warning ("ANSI C does not support the `%c' length modifier",
length_char);
} }
else else
length_char = 0; length_char = 0;
if (length_char == 'l' && *format_chars == 'l') if (length_char == 'l' && *format_chars == 'l')
{ {
length_char = 'q', format_chars++; length_char = 'q', format_chars++;
/* FIXME: Is allowed in ISO C 9x. */ if (pedantic && !flag_isoc9x)
if (pedantic)
warning ("ANSI C does not support the `ll' length modifier"); warning ("ANSI C does not support the `ll' length modifier");
} }
else if (length_char == 'h' && *format_chars == 'h') else if (length_char == 'h' && *format_chars == 'h')
{ {
length_char = 'H', format_chars++; length_char = 'H', format_chars++;
/* FIXME: Is allowed in ISO C 9x. */ if (pedantic && !flag_isoc9x)
if (pedantic)
warning ("ANSI C does not support the `hh' length modifier"); warning ("ANSI C does not support the `hh' length modifier");
} }
if (*format_chars == 'a' && info->format_type == scanf_format_type) if (*format_chars == 'a' && info->format_type == scanf_format_type)
...@@ -1810,10 +1809,10 @@ check_format_info (info, params) ...@@ -1810,10 +1809,10 @@ check_format_info (info, params)
if (pedantic && info->format_type != strftime_format_type if (pedantic && info->format_type != strftime_format_type
&& (format_char == 'm' || format_char == 'C' || format_char == 'S')) && (format_char == 'm' || format_char == 'C' || format_char == 'S'))
warning ("ANSI C does not support the `%c' format", format_char); warning ("ANSI C does not support the `%c' format", format_char);
/* ??? The a and A formats are C9X extensions, and should be allowed /* The a and A formats are C99 extensions. */
when a C9X option is added. */
if (pedantic && info->format_type != strftime_format_type if (pedantic && info->format_type != strftime_format_type
&& (format_char == 'a' || format_char == 'A')) && (format_char == 'a' || format_char == 'A')
&& !flag_isoc9x)
warning ("ANSI C does not support the `%c' format", format_char); warning ("ANSI C does not support the `%c' format", format_char);
format_chars++; format_chars++;
switch (info->format_type) switch (info->format_type)
...@@ -1912,7 +1911,7 @@ check_format_info (info, params) ...@@ -1912,7 +1911,7 @@ check_format_info (info, params)
case 'l': wanted_type = fci->llen ? *(fci->llen) : 0; break; case 'l': wanted_type = fci->llen ? *(fci->llen) : 0; break;
case 'q': wanted_type = fci->qlen ? *(fci->qlen) : 0; break; case 'q': wanted_type = fci->qlen ? *(fci->qlen) : 0; break;
case 'L': wanted_type = fci->bigllen ? *(fci->bigllen) : 0; break; case 'L': wanted_type = fci->bigllen ? *(fci->bigllen) : 0; break;
case 'Z': wanted_type = fci->zlen ? *fci->zlen : 0; break; case 'z': case 'Z': wanted_type = fci->zlen ? *fci->zlen : 0; break;
} }
if (wanted_type == 0) if (wanted_type == 0)
warning ("use of `%c' length character with `%c' type character", warning ("use of `%c' length character with `%c' type character",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment