From e7996da3faa8f5f011336f6bf45f220d36c1c50e Mon Sep 17 00:00:00 2001 From: obrien Date: Fri, 27 Aug 1999 10:05:08 +0000 Subject: 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 --- contrib/gcc/c-common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/gcc/c-common.c b/contrib/gcc/c-common.c index 5e5b712..53a8bba 100644 --- a/contrib/gcc/c-common.c +++ b/contrib/gcc/c-common.c @@ -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) -- cgit v1.1