Subject: bin/1089: cc -ansi -pedantic doesn't notice %qd
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 05/30/1995 10:50:08
>Number: 1089
>Category: bin
>Synopsis: cc -ansi -pedantic doesn't notice %qd
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 30 10:50:03 1995
>Originator: der Mouse
>Organization:
Dis-
>Release: -current as of May 9th
>Environment:
NetBSD/sparc on an IPC, not that it matters
>Description:
cc -ansi -pedantic fails to notice that q is not an allowed
length modifier according to ANSI.
>How-To-Repeat:
Use -ansi -pedantic on a program that uses the q length
modifier, and notice the lack of a warning about it.
For example,
% cat z.c
#include <stdio.h>
main(){printf("%qd\n",1LL);}
% cc -ansi -pedantic -o z z.c
...four warnings, three from include files and one from the
1LL, but none from the %qd...
%
>Fix:
Apply the following in gnu/usr.bin/gcc2/cc1. (As of this
writing, I have not tested this; I'm doing that, but rebuilding
the relevant fraction of gcc is taking a long time. And the
change is small and well-isolated, so I don't expect trouble.)
*** c-typeck.c= Tue May 30 12:55:22 1995
--- c-typeck.c Tue May 30 13:19:41 1995
***************
*** 1652,1658 ****
}
if (*format_chars == 'h' || *format_chars == 'l' || *format_chars == 'q' ||
*format_chars == 'L')
! length_char = *format_chars++;
else
length_char = 0;
if (suppressed && length_char != 0)
--- 1652,1662 ----
}
if (*format_chars == 'h' || *format_chars == 'l' || *format_chars == 'q' ||
*format_chars == 'L')
! {
! length_char = *format_chars++;
! if ((length_char == 'q') && pedantic)
! pedwarn ("ANSI C does not allow the q length modifier\n");
! }
else
length_char = 0;
if (suppressed && length_char != 0)
der Mouse
mouse@collatz.mcrcim.mcgill.edu
>Audit-Trail:
>Unformatted: