Don't accept %q length specifiers in the kernel (more precisely,

if compiling with -fformat-extensions). Gcc's format checker never
actually supported %q length specifiers.  It treats %q as an alias
for %ll, which is correct if quad_t is long long (e.g., on i386's)
and broken otherwise (e.g., on alphas).

quad_t's currently should be printed in the same way that they
already need to be printed to avoid compiler warnings on all
supported systems: cast them to a standard type that is at least
as large (long or long long) and use the length specifier for that
(%l or %ll).  This is problematic since long long isn't standard
yet.  C9x's intmax_t should be implemented soon.

Don't accept %L length specifiers in the kernel either.  The only
legitimate ones are for long doubles, but the kernel doesn't even
support plain doubles.  (gcc bogusly accepts %Ld as an alias for
%lld, and it sometimes prints "q" in error messages about "ll" and
"L" length specifiers, becauses it represents all these specifiers
as 'q'.)

Submitted by:	bde
This commit is contained in:
obrien 1999-08-27 10:05:08 +00:00
parent 3528dc25c8
commit 1211c446fc

View File

@ -1615,7 +1615,8 @@ check_format_info (info, params)
{
if (*format_chars == 'h' || *format_chars == 'l')
length_char = *format_chars++;
else if (*format_chars == 'q' || *format_chars == 'L')
else if ((*format_chars == 'q' || *format_chars == 'L')
&& !flag_format_extensions)
{
length_char = *format_chars++;
if (pedantic)