This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Warning for #line 32768


The ANSI C Standard says that a #line directive with a line number
non-positive or greater than 32767 invokes undefined behavior.  We do
warn for <=0, but not for >32767.  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* cpplib.c (do_line): Pedwarn for #line > 32767.
	
Index: gcc/cpplib.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.c,v
retrieving revision 1.115
diff -u -r1.115 cpplib.c
--- gcc/cpplib.c	2000/02/14 07:57:30	1.115
+++ gcc/cpplib.c	2000/02/16 05:35:55
@@ -1346,7 +1346,7 @@
     }      
   CPP_SET_WRITTEN (pfile, old_written);
 
-  if (CPP_PEDANTIC (pfile) && new_lineno <= 0)
+  if (CPP_PEDANTIC (pfile) && (new_lineno <= 0 || new_lineno > 32767))
     cpp_pedwarn (pfile, "line number out of range in `#line' command");
 
   token = get_directive_token (pfile);

-- 
Alexandre Oliva     http://www.ic.unicamp.br/~oliva/     Enjoy Guaranį
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]