2.95.4 plans
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Tue Mar 20 15:54:00 GMT 2001
> From: Bernd Schmidt <bernds@redhat.com>
>
> On Sun, 18 Mar 2001, Kaveh R. Ghazi wrote:
>
> > The patch is that I'd like to apply the following from the mainline.
> >
> > > 1999-11-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
> > >
> > > * c-lex.c (yylex): With -Wtraditional, when the ANSI type of an
> > > integer constant does not match the traditional type, limit the
> > > warnings to cases where the base of the type is ten.
> > >
> > > * invoke.texi (-Wtraditional): Document it.
> >
> > http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-lex.c.diff?r1=1.66&r2=1.67
> > http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/invoke.texi.diff?r1=1.155&r2=1.156
> >
>
> Ok.
> Bernd
Thanks, here's what I installed on the 2.95.x branch.
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.3667.4.340
diff -u -p -r1.3667.4.340 ChangeLog
--- ChangeLog 2001/03/20 19:51:49 1.3667.4.340
+++ ChangeLog 2001/03/20 23:48:49
@@ -1,3 +1,12 @@
+Tue Mar 20 18:31:48 2001 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ 1999-11-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * c-lex.c (yylex): With -Wtraditional, when the ANSI type of an
+ integer constant does not match the traditional type, limit the
+ warnings to cases where the base of the type is ten.
+
+ * invoke.texi (-Wtraditional): Document it.
+
2001-03-20 David O'Brien <obrien@FreeBSD.org>
from 2000-07-12 Zack Weinberg <zack@wolery.cumb.org>
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.49
diff -u -p -r1.49 c-lex.c
--- c-lex.c 1999/03/20 19:21:23 1.49
+++ c-lex.c 2001/03/20 23:48:50
@@ -1812,7 +1812,11 @@ yylex ()
type = flag_traditional ? traditional_type : ansi_type;
- if (warn_traditional && traditional_type != ansi_type)
+ /* We assume that constants specified in a non-decimal
+ base are bit patterns, and that the programmer really
+ meant what they wrote. */
+ if (warn_traditional && base == 10
+ && traditional_type != ansi_type)
{
if (TYPE_PRECISION (traditional_type)
!= TYPE_PRECISION (ansi_type))
Index: invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/invoke.texi,v
retrieving revision 1.111.4.13
diff -u -p -r1.111.4.13 invoke.texi
--- invoke.texi 2001/01/25 14:03:17 1.111.4.13
+++ invoke.texi 2001/03/20 23:48:53
@@ -1694,6 +1694,12 @@ A @code{switch} statement has an operand
@item
A non-@code{static} function declaration follows a @code{static} one.
This construct is not accepted by some traditional C compilers.
+
+@item
+The ANSI type of an integer constant has a different width or signedness
+from its traditional type. This warning is only issued if the base of
+the constant is ten. I.e. hexadecimal or octal values, which typically
+represent bit patterns, are not warned about.
@end itemize
@item -Wundef
More information about the Gcc-patches
mailing list