upstream gcc stopped warning about missing newlines at eof
five years ago, here is a diff to do the same for our gcc3/gcc4.

Index: gcc/libcpp/lex.c
===================================================================
RCS file: /cvs/src/gnu/gcc/libcpp/lex.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 lex.c
--- gcc/libcpp/lex.c    15 Oct 2009 17:11:30 -0000      1.1.1.1
+++ gcc/libcpp/lex.c    2 May 2013 08:05:12 -0000
@@ -837,9 +837,6 @@ _cpp_get_fresh_line (cpp_reader *pfile)
        {
          /* Only warn once.  */
          buffer->next_line = buffer->rlimit;
-         cpp_error_with_line (pfile, CPP_DL_PEDWARN, 
pfile->line_table->highest_line,
-                              CPP_BUF_COLUMN (buffer, buffer->cur),
-                              "no newline at end of file");
        }
 
       return_at_eof = buffer->return_at_eof;
Index: usr.bin/gcc/gcc/cpplex.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/gcc/gcc/cpplex.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 cpplex.c
--- usr.bin/gcc/gcc/cpplex.c    29 Nov 2003 12:21:48 -0000      1.1.1.1
+++ usr.bin/gcc/gcc/cpplex.c    2 May 2013 08:14:59 -0000
@@ -911,8 +911,6 @@ continue_after_nul (pfile)
            {
              /* Non-empty files should end in a newline.  Don't warn
                 for command line and _Pragma buffers.  */
-             if (!buffer->from_stage3)
-               cpp_error (pfile, DL_PEDWARN, "no newline at end of file");
              handle_newline (pfile);
            }
 
Index: usr.bin/gcc/gcc/cpptrad.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/gcc/gcc/cpptrad.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 cpptrad.c
--- usr.bin/gcc/gcc/cpptrad.c   24 Dec 2004 23:51:31 -0000      1.1.1.2
+++ usr.bin/gcc/gcc/cpptrad.c   2 May 2013 08:14:30 -0000
@@ -487,8 +487,6 @@ scan_out_logical_line (pfile, macro)
 
          /* Premature end of file.  Fake a new line.  */
          cur--;
-         if (!pfile->buffer->from_stage3)
-           cpp_error (pfile, DL_PEDWARN, "no newline at end of file");
          pfile->line++;
          goto done;
 

Reply via email to