Author: marek
Date: 2005-10-29 15:30:48 -0400 (Sat, 29 Oct 2005)
New Revision: 52381

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/cs-tokenizer.cs
   trunk/mcs/mcs/driver.cs
   trunk/mcs/mcs/report.cs
Log:
2005-10-29  Marek Safar  <[EMAIL PROTECTED]>
 
        * cs-tokenizer.cs: Warning text fix.

        * driver.cs: AllWarningNumbers exposed on public interface.

        * report.cs (): Reviewed warning numbers.
        (IsValidWarning): Use binary search.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-10-29 17:28:04 UTC (rev 52380)
+++ trunk/mcs/mcs/ChangeLog     2005-10-29 19:30:48 UTC (rev 52381)
@@ -1,5 +1,14 @@
 2005-10-29  Marek Safar  <[EMAIL PROTECTED]>
  
+       * cs-tokenizer.cs: Warning text fix.
+
+       * driver.cs: AllWarningNumbers exposed on public interface.
+
+       * report.cs (): Reviewed warning numbers.
+       (IsValidWarning): Use binary search.
+
+2005-10-29  Marek Safar  <[EMAIL PROTECTED]>
+ 
        * driver.cs: Implemeted resource visibility.
        (Resources): New class for code sharing between /res: and
        /linkres:

Modified: trunk/mcs/mcs/cs-tokenizer.cs
===================================================================
--- trunk/mcs/mcs/cs-tokenizer.cs       2005-10-29 17:28:04 UTC (rev 52380)
+++ trunk/mcs/mcs/cs-tokenizer.cs       2005-10-29 19:30:48 UTC (rev 52381)
@@ -1375,7 +1375,7 @@
                                Hashtable w_table = Report.warning_ignore_table;
                                foreach (int code in codes) {
                                        if (w_table != null && w_table.Contains 
(code))
-                                               Report.Warning (1635, 1, 
Location, "Cannot restore warning 'CS{0:0000}' because it was disabled 
globally", code);
+                                               Report.Warning (1635, 1, 
Location, "Cannot restore warning `CS{0:0000}' because it was disabled 
globally", code);
                                        Report.RegisterWarningRegion 
(Location).WarningEnable (Location, code);
                                }
                                return;

Modified: trunk/mcs/mcs/driver.cs
===================================================================
--- trunk/mcs/mcs/driver.cs     2005-10-29 17:28:04 UTC (rev 52380)
+++ trunk/mcs/mcs/driver.cs     2005-10-29 19:30:48 UTC (rev 52381)
@@ -1948,6 +1948,12 @@
                                Reset ();
                        }
                }
+
+               public static int[] AllWarningNumbers {
+                       get {
+                               return Report.AllWarnings;
+                       }
+               }
                
                static void Reset ()
                {

Modified: trunk/mcs/mcs/report.cs
===================================================================
--- trunk/mcs/mcs/report.cs     2005-10-29 17:28:04 UTC (rev 52380)
+++ trunk/mcs/mcs/report.cs     2005-10-29 19:30:48 UTC (rev 52381)
@@ -6,9 +6,6 @@
 // (C) 2001 Ximian, Inc. (http://www.ximian.com)
 //
 
-//
-// FIXME: currently our class library does not support custom number format 
strings
-//
 using System;
 using System.IO;
 using System.Text;
@@ -71,6 +68,30 @@
                /// </summary>
                static StringCollection extra_information = new 
StringCollection ();
 
+               // 
+               // IF YOU ADD A NEW WARNING YOU HAVE TO ADD ITS ID HERE
+               //
+               public static readonly int[] AllWarnings = new int[] {
+                                                                               
                                                 28, 67, 78,
+                                                                               
                                                 105, 108, 109, 114, 162, 164, 
168, 169, 183, 184, 197,
+                                                                               
                                                 219, 251, 252, 253, 282,
+                                                                               
                                                 419, 420, 429, 436, 440, 465,
+                                                                               
                                                 612, 618, 626, 628, 642, 649, 
652, 658, 659, 660, 661, 665, 672,
+                                                                               
                                                 1030, 1058,
+                                                                               
                                                 1522, 1570, 1571, 1572, 1573, 
1574, 1580, 1581, 1584, 1587, 1589, 1590, 1591, 1592,
+                                                                               
                                                 1616, 1633, 1634, 1635, 1691, 
1692,
+                                                                               
                                                 1717, 1718,
+                                                                               
                                                 1901,
+                                                                               
                                                 2002, 2023,
+                                                                               
                                                 3005, 3012, 3019, 3021, 3022, 
3023, 3026, 3027
+                                                                               
                                         };
+
+               static Report ()
+               {
+                       // Just to be sure that binary search is working
+                       Array.Sort (AllWarnings);
+               }
+
                public static void Reset ()
                {
                        Errors = Warnings = 0;
@@ -268,21 +289,9 @@
                        Console.WriteLine (FriendlyStackTrace (new StackTrace 
(true)));
                }
 
-               // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-               // IF YOU ADD A NEW WARNING YOU HAVE TO DUPLICATE ITS ID HERE
-               //
                public static bool IsValidWarning (int code)
-               {
-                       int[] all_warnings = new int[] {
-                               28, 67, 78, 105, 108, 109, 114, 192, 168, 169, 
183, 184, 219, 251, 612, 618, 626, 628, 642, 649,
-                               659, 660, 661, 672, 1030, 1522, 1616, 1691, 
1692, 1901, 2002, 2023, 3012, 3019, 8024, 8028
-                       };
-                       
-                       foreach (int i in all_warnings) {
-                               if (i == code)
-                                       return true;
-                       }
-                       return false;
+               {       
+                       return Array.BinarySearch (AllWarnings, code) >= 0;
                }
                
                static public void LocationOfPreviousError (Location loc)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to