# check for adding lines without a newline.
                if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
-                       WARN("MISSING_EOF_NEWLINE",
-                            "adding a line without newline at end of file\n" . $herecurr);
+                       if (WARN("MISSING_EOF_NEWLINE",
+                                "adding a line without newline at end of file\n" . $herecurr) &&
+                           $fix) {
+                               fix_delete_line($fixlinenr+1, "No newline at end of file");
+                       }
                }
 
 # check we are in a valid source file C or perl if not then ignore this hunk