summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-08-27 10:05:08 +0000
committerobrien <obrien@FreeBSD.org>1999-08-27 10:05:08 +0000
commite7996da3faa8f5f011336f6bf45f220d36c1c50e (patch)
treeb7e9b4ef1abb87b3558f260ab7eef264b9b68e27
parenta774007e84fd58a2abdd7a9d186f05144e2abe24 (diff)
downloadFreeBSD-src-e7996da3faa8f5f011336f6bf45f220d36c1c50e.zip
FreeBSD-src-e7996da3faa8f5f011336f6bf45f220d36c1c50e.tar.gz
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
-rw-r--r--contrib/gcc/c-common.c3
1 files changed, 2 insertions, 1 deletions
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)
OpenPOWER on IntegriCloud