[657601] Fixes parsing pragma warning when encounter eof
authorMarek Safar <marek.safar@gmail.com>
Fri, 17 Dec 2010 09:05:21 +0000 (09:05 +0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 17 Dec 2010 09:36:09 +0000 (09:36 +0000)
mcs/mcs/cs-tokenizer.cs
mcs/tests/test-802.cs [new file with mode: 0644]

index 5e4b2ebba7ce5d3a3f2d16d4d4377643ca69c948..4692fccda80b3e80cd5badfa0ae906bff34030d2 100644 (file)
@@ -2182,7 +2182,7 @@ namespace Mono.CSharp
                                                                                Report.RegisterWarningRegion (loc).WarningEnable (loc, code, Report);
                                                                        }
                                                                }
-                                                       } while (code >= 0 && c != '\n');
+                                                       } while (code >= 0 && c != '\n' && c != -1);
                                                }
 
                                                return;
diff --git a/mcs/tests/test-802.cs b/mcs/tests/test-802.cs
new file mode 100644 (file)
index 0000000..e232e30
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma warning disable 1591
+public class C
+{
+       public static void Main ()
+       {
+               // only to test tokenizer with eof
+       }
+}
+#pragma warning restore 1591
\ No newline at end of file