Commit bc516719 by Andreas Schwab Committed by Andreas Schwab

c-common.c (check_format_info): Put back check for C9x `hh' length modifier.

	* c-common.c (check_format_info): Put back check for C9x `hh'
	length modifier.  Warn about %n format writing into const.  Remove
	obsolete comment.
	(format_char_info): Fix comments.

From-SVN: r20207
parent 7fdc2757
Wed Jun 3 11:02:24 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> Wed Jun 3 11:02:24 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* c-common.c (check_format_info): Put back check for C9x `hh'
length modifier. Warn about %n format writing into const. Remove
obsolete comment.
(format_char_info): Fix comments.
* configure.in: Set float_format to m68k for all m68k targets that * configure.in: Set float_format to m68k for all m68k targets that
do not override LONG_DOUBLE_TYPE_SIZE. do not override LONG_DOUBLE_TYPE_SIZE.
* config/float-m68k.h: New file. * config/float-m68k.h: New file.
......
...@@ -979,10 +979,10 @@ typedef struct { ...@@ -979,10 +979,10 @@ typedef struct {
int pointer_count; int pointer_count;
/* Type of argument if no length modifier is used. */ /* Type of argument if no length modifier is used. */
tree *nolen; tree *nolen;
/* Type of argument if length modifier for shortening is used. /* Type of argument if length modifier for shortening to byte is used.
If NULL, then this modifier is not allowed. */ If NULL, then this modifier is not allowed. */
tree *hhlen; tree *hhlen;
/* Type of argument if length modifier for shortening to byte if used. /* Type of argument if length modifier for shortening is used.
If NULL, then this modifier is not allowed. */ If NULL, then this modifier is not allowed. */
tree *hlen; tree *hlen;
/* Type of argument if length modifier `l' is used. /* Type of argument if length modifier `l' is used.
...@@ -1556,6 +1556,13 @@ check_format_info (info, params) ...@@ -1556,6 +1556,13 @@ check_format_info (info, params)
if (pedantic) 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')
{
length_char = 'H', format_chars++;
/* FIXME: Is allowed in ISO C 9x. */
if (pedantic)
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)
{ {
if (format_chars[1] == 's' || format_chars[1] == 'S' if (format_chars[1] == 's' || format_chars[1] == 'S'
...@@ -1688,15 +1695,6 @@ check_format_info (info, params) ...@@ -1688,15 +1695,6 @@ check_format_info (info, params)
warning ("use of `%c' length character with `%c' type character", warning ("use of `%c' length character with `%c' type character",
length_char, format_char); length_char, format_char);
/*
** XXX -- should kvetch about stuff such as
** {
** const int i;
**
** scanf ("%d", &i);
** }
*/
/* Finally. . .check type of argument against desired type! */ /* Finally. . .check type of argument against desired type! */
if (info->first_arg_num == 0) if (info->first_arg_num == 0)
continue; continue;
...@@ -1739,8 +1737,10 @@ check_format_info (info, params) ...@@ -1739,8 +1737,10 @@ check_format_info (info, params)
} }
/* See if this is an attempt to write into a const type with /* See if this is an attempt to write into a const type with
scanf. */ scanf or with printf "%n". */
if (info->format_type == scanf_format_type if ((info->format_type == scanf_format_type
|| (info->format_type == printf_format_type
&& format_char == 'n'))
&& i == fci->pointer_count + aflag && i == fci->pointer_count + aflag
&& wanted_type != 0 && wanted_type != 0
&& TREE_CODE (cur_type) != ERROR_MARK && TREE_CODE (cur_type) != ERROR_MARK
......
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