aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@cygnus.com>1998-03-25 13:42:05 +0000
committerJim Wilson <wilson@gcc.gnu.org>1998-03-25 05:42:05 -0800
commita16b4c9c69c516b40af4b868ce9135cae8f9fd25 (patch)
treea7307a2131ea08179f908c7ad4ffaa3fd01ddd4d /gcc/c-common.c
parentc4d38ccb5503a83780195612df44b2927e187e6a (diff)
downloadgcc-a16b4c9c69c516b40af4b868ce9135cae8f9fd25.zip
gcc-a16b4c9c69c516b40af4b868ce9135cae8f9fd25.tar.gz
gcc-a16b4c9c69c516b40af4b868ce9135cae8f9fd25.tar.bz2
Fix bug reported by David C Binderman, accept 'L' when pedantic with FP format.
* c-common.c (check_format_info): Initialize type, is_type. New local integral_format. Don't warn for 'L' when pedantic. Do warn for 'L' when pedantic if used with integral format specifier. From-SVN: r18827
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 952306e..efc6051 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -379,8 +379,8 @@ void
decl_attributes (node, attributes, prefix_attributes)
tree node, attributes, prefix_attributes;
{
- tree decl = 0, type;
- int is_type;
+ tree decl = 0, type = 0;
+ int is_type = 0;
tree a;
if (attrtab_idx == 0)
@@ -1185,6 +1185,7 @@ check_format_info (info, params)
int length_char;
int format_char;
int format_length;
+ int integral_format;
tree format_tree;
tree cur_param;
tree cur_type;
@@ -1448,7 +1449,7 @@ check_format_info (info, params)
else if (*format_chars == 'q' || *format_chars == 'L')
{
length_char = *format_chars++;
- if (pedantic)
+ if (pedantic && length_char == 'q')
pedwarn ("ANSI C does not support the `%c' length modifier",
length_char);
}
@@ -1557,10 +1558,10 @@ check_format_info (info, params)
warning (message);
}
}
- if (precise && index (flag_chars, '0') != 0
- && (format_char == 'd' || format_char == 'i'
- || format_char == 'o' || format_char == 'u'
- || format_char == 'x' || format_char == 'x'))
+ integral_format = (format_char == 'd' || format_char == 'i'
+ || format_char == 'o' || format_char == 'u'
+ || format_char == 'x' || format_char == 'x');
+ if (precise && index (flag_chars, '0') != 0 && integral_format)
{
sprintf (message,
"`0' flag ignored with precision specifier and `%c' format",
@@ -1575,7 +1576,8 @@ check_format_info (info, params)
case 'q': wanted_type = fci->qlen ? *(fci->qlen) : 0; break;
case 'L': wanted_type = fci->bigllen ? *(fci->bigllen) : 0; break;
}
- if (wanted_type == 0)
+ if (wanted_type == 0
+ || (pedantic && length_char == 'L' && integral_format))
{
sprintf (message,
"use of `%c' length character with `%c' type character",