2 // report.cs: report errors and warnings.
4 // Author: Miguel de Icaza (miguel@ximian.com)
5 // Marek Safar (marek.safar@seznam.cz)
7 // Copyright 2001 Ximian, Inc. (http://www.ximian.com)
13 using System
.Collections
;
14 using System
.Collections
.Specialized
;
15 using System
.Diagnostics
;
16 using System
.Reflection
;
17 using System
.Reflection
.Emit
;
19 namespace Mono
.CSharp
{
22 // Errors and warnings manager
26 /// Whether errors should be throw an exception
31 /// Whether warnings should be considered errors
33 public bool WarningsAreErrors
;
34 ArrayList warnings_as_error
;
35 ArrayList warnings_only
;
37 public static int DebugFlags
= 0;
40 // Keeps track of the warnings that we are ignoring
42 public Hashtable warning_ignore_table
;
44 Hashtable warning_regions_table
;
48 ReportPrinter printer
;
50 int reporting_disabled
;
53 /// List of symbols related to reported error/warning. You have to fill it before error/warning is reported.
55 ArrayList extra_information
= new ArrayList ();
58 // IF YOU ADD A NEW WARNING YOU HAVE TO ADD ITS ID HERE
60 public static readonly int[] AllWarnings
= new int[] {
62 105, 108, 109, 114, 162, 164, 168, 169, 183, 184, 197,
63 219, 251, 252, 253, 278, 282,
64 402, 414, 419, 420, 429, 436, 440, 458, 464, 465, 467, 469, 472,
65 612, 618, 626, 628, 642, 649, 652, 658, 659, 660, 661, 665, 672, 675, 693,
68 1522, 1570, 1571, 1572, 1573, 1574, 1580, 1581, 1584, 1587, 1589, 1590, 1591, 1592,
69 1616, 1633, 1634, 1635, 1685, 1690, 1691, 1692,
70 1700, 1717, 1718, 1720,
73 3000, 3001, 3002, 3003, 3005, 3006, 3007, 3008, 3009,
74 3010, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019,
75 3021, 3022, 3023, 3024, 3026, 3027
80 // Just to be sure that binary search is working
81 Array
.Sort (AllWarnings
);
84 public Report (ReportPrinter printer
)
87 throw new ArgumentNullException ("printer");
89 this.printer
= printer
;
93 public void DisableReporting ()
98 public void EnableReporting ()
100 --reporting_disabled
;
103 public void FeatureIsNotAvailable (Location loc
, string feature
)
106 switch (RootContext
.Version
) {
107 case LanguageVersion
.ISO_1
:
110 case LanguageVersion
.ISO_2
:
113 case LanguageVersion
.V_3
:
117 throw new InternalErrorException ("Invalid feature version", RootContext
.Version
);
121 "Feature `{0}' cannot be used because it is not part of the C# {1} language specification",
125 public void FeatureIsNotSupported (Location loc
, string feature
)
128 "Feature `{0}' is not supported in Mono mcs1 compiler. Consider using the `gmcs' compiler instead",
132 static bool IsValidWarning (int code
)
134 return Array
.BinarySearch (AllWarnings
, code
) >= 0;
137 bool IsWarningEnabled (int code
, int level
, Location loc
)
139 if (WarningLevel
< level
)
142 if (warning_ignore_table
!= null) {
143 if (warning_ignore_table
.Contains (code
)) {
148 if (warning_regions_table
== null || loc
.IsNull
)
151 WarningRegions regions
= (WarningRegions
) warning_regions_table
[loc
.Name
];
155 return regions
.IsWarningEnabled (code
, loc
.Row
);
158 bool IsWarningAsError (int code
)
160 bool is_error
= WarningsAreErrors
;
162 // Check specific list
163 if (warnings_as_error
!= null)
164 is_error
|= warnings_as_error
.Contains (code
);
166 // Ignore excluded warnings
167 if (warnings_only
!= null && warnings_only
.Contains (code
))
173 public void RuntimeMissingSupport (Location loc
, string feature
)
175 Error (-88, loc
, "Your .NET Runtime does not support `{0}'. Please use the latest Mono runtime instead.", feature
);
179 /// In most error cases is very useful to have information about symbol that caused the error.
180 /// Call this method before you call Report.Error when it makes sense.
182 public void SymbolRelatedToPreviousError (Location loc
, string symbol
)
184 SymbolRelatedToPreviousError (loc
.ToString (), symbol
);
187 public void SymbolRelatedToPreviousError (MemberInfo mi
)
189 if (reporting_disabled
> 0 || !printer
.HasRelatedSymbolSupport
)
192 Type dt
= TypeManager
.DropGenericTypeArguments (mi
.DeclaringType
);
193 if (TypeManager
.IsDelegateType (dt
)) {
194 SymbolRelatedToPreviousError (dt
);
198 DeclSpace temp_ds
= TypeManager
.LookupDeclSpace (dt
);
199 if (temp_ds
== null) {
200 SymbolRelatedToPreviousError (dt
.Assembly
.Location
, TypeManager
.GetFullNameSignature (mi
));
202 MethodBase mb
= mi
as MethodBase
;
204 mb
= TypeManager
.DropGenericMethodArguments (mb
);
205 IMethodData md
= TypeManager
.GetMethod (mb
);
207 SymbolRelatedToPreviousError (md
.Location
, md
.GetSignatureForError ());
212 // FIXME: Completely wrong, it has to use FindMembers
213 MemberCore mc
= temp_ds
.GetDefinition (mi
.Name
);
215 SymbolRelatedToPreviousError (mc
);
219 public void SymbolRelatedToPreviousError (MemberCore mc
)
221 SymbolRelatedToPreviousError (mc
.Location
, mc
.GetSignatureForError ());
224 public void SymbolRelatedToPreviousError (Type type
)
226 if (reporting_disabled
> 0 || !printer
.HasRelatedSymbolSupport
)
229 type
= TypeManager
.DropGenericTypeArguments (type
);
231 if (TypeManager
.IsGenericParameter (type
)) {
232 TypeParameter tp
= TypeManager
.LookupTypeParameter (type
);
234 SymbolRelatedToPreviousError (tp
.Location
, "");
239 if (type
is TypeBuilder
) {
240 DeclSpace temp_ds
= TypeManager
.LookupDeclSpace (type
);
241 SymbolRelatedToPreviousError (temp_ds
.Location
, TypeManager
.CSharpName (type
));
242 } else if (TypeManager
.HasElementType (type
)) {
243 SymbolRelatedToPreviousError (TypeManager
.GetElementType (type
));
245 SymbolRelatedToPreviousError (type
.Assembly
.Location
, TypeManager
.CSharpName (type
));
249 void SymbolRelatedToPreviousError (string loc
, string symbol
)
251 string msg
= String
.Format ("{0} (Location of the symbol related to previous ", loc
);
252 if (extra_information
.Contains (msg
))
255 extra_information
.Add (msg
);
258 public void AddWarningAsError (string warningId
)
262 id
= int.Parse (warningId
);
267 if (!CheckWarningCode (id
, warningId
, Location
.Null
))
270 if (warnings_as_error
== null)
271 warnings_as_error
= new ArrayList ();
273 warnings_as_error
.Add (id
);
276 public void RemoveWarningAsError (string warningId
)
280 id
= int.Parse (warningId
);
285 if (!CheckWarningCode (id
, warningId
, Location
.Null
))
288 if (warnings_only
== null)
289 warnings_only
= new ArrayList ();
291 warnings_only
.Add (id
);
294 public bool CheckWarningCode (int code
, Location loc
)
296 return CheckWarningCode (code
, code
.ToString (), loc
);
299 public bool CheckWarningCode (int code
, string scode
, Location loc
)
301 if (IsValidWarning (code
))
304 Warning (1691, 1, loc
, "`{0}' is not a valid warning number", scode
);
308 public void ExtraInformation (Location loc
, string msg
)
310 extra_information
.Add (String
.Format ("{0} {1}", loc
, msg
));
313 public WarningRegions
RegisterWarningRegion (Location location
)
315 if (warning_regions_table
== null)
316 warning_regions_table
= new Hashtable ();
318 WarningRegions regions
= (WarningRegions
)warning_regions_table
[location
.Name
];
319 if (regions
== null) {
320 regions
= new WarningRegions ();
321 warning_regions_table
.Add (location
.Name
, regions
);
326 public void Warning (int code
, int level
, Location loc
, string message
)
328 if (reporting_disabled
> 0)
331 if (!IsWarningEnabled (code
, level
, loc
))
335 if (IsWarningAsError (code
))
336 msg
= new ErrorMessage (code
, loc
, message
, extra_information
);
338 msg
= new WarningMessage (code
, loc
, message
, extra_information
);
340 extra_information
.Clear ();
344 public void Warning (int code
, int level
, Location loc
, string format
, string arg
)
346 Warning (code
, level
, loc
, String
.Format (format
, arg
));
349 public void Warning (int code
, int level
, Location loc
, string format
, string arg1
, string arg2
)
351 Warning (code
, level
, loc
, String
.Format (format
, arg1
, arg2
));
354 public void Warning (int code
, int level
, Location loc
, string format
, params object[] args
)
356 Warning (code
, level
, loc
, String
.Format (format
, args
));
359 public void Warning (int code
, int level
, string message
)
361 Warning (code
, level
, Location
.Null
, message
);
364 public void Warning (int code
, int level
, string format
, string arg
)
366 Warning (code
, level
, Location
.Null
, format
, arg
);
369 public void Warning (int code
, int level
, string format
, string arg1
, string arg2
)
371 Warning (code
, level
, Location
.Null
, format
, arg1
, arg2
);
374 public void Warning (int code
, int level
, string format
, params string[] args
)
376 Warning (code
, level
, Location
.Null
, String
.Format (format
, args
));
380 // Warnings encountered so far
382 public int Warnings
{
383 get { return printer.WarningsCount; }
386 public void Error (int code
, Location loc
, string error
)
388 if (reporting_disabled
> 0)
391 ErrorMessage msg
= new ErrorMessage (code
, loc
, error
, extra_information
);
392 extra_information
.Clear ();
397 throw new Exception (msg
.Text
);
400 public void Error (int code
, Location loc
, string format
, string arg
)
402 Error (code
, loc
, String
.Format (format
, arg
));
405 public void Error (int code
, Location loc
, string format
, string arg1
, string arg2
)
407 Error (code
, loc
, String
.Format (format
, arg1
, arg2
));
410 public void Error (int code
, Location loc
, string format
, params object[] args
)
412 Error (code
, loc
, String
.Format (format
, args
));
415 public void Error (int code
, string error
)
417 Error (code
, Location
.Null
, error
);
420 public void Error (int code
, string format
, string arg
)
422 Error (code
, Location
.Null
, format
, arg
);
425 public void Error (int code
, string format
, string arg1
, string arg2
)
427 Error (code
, Location
.Null
, format
, arg1
, arg2
);
430 public void Error (int code
, string format
, params string[] args
)
432 Error (code
, Location
.Null
, String
.Format (format
, args
));
436 // Errors encountered so far
439 get { return printer.ErrorsCount; }
442 public ReportPrinter Printer
{
443 get { return printer; }
446 public void SetIgnoreWarning (int code
)
448 if (warning_ignore_table
== null)
449 warning_ignore_table
= new Hashtable ();
451 warning_ignore_table
[code
] = true;
454 public ReportPrinter
SetPrinter (ReportPrinter printer
)
456 ReportPrinter old
= this.printer
;
457 this.printer
= printer
;
461 public int WarningLevel
{
463 return warning_level
;
466 warning_level
= value;
470 [Conditional ("MCS_DEBUG")]
471 static public void Debug (string message
, params object[] args
)
473 Debug (4, message
, args
);
476 [Conditional ("MCS_DEBUG")]
477 static public void Debug (int category
, string message
, params object[] args
)
479 if ((category
& DebugFlags
) == 0)
482 StringBuilder sb
= new StringBuilder (message
);
484 if ((args
!= null) && (args
.Length
> 0)) {
488 foreach (object arg
in args
) {
495 else if (arg
is ICollection
)
496 sb
.Append (PrintCollection ((ICollection
) arg
));
502 Console
.WriteLine (sb
.ToString ());
505 static public string PrintCollection (ICollection collection
)
507 StringBuilder sb
= new StringBuilder ();
509 sb
.Append (collection
.GetType ());
513 foreach (object o
in collection
) {
522 return sb
.ToString ();
526 public abstract class AbstractMessage
528 readonly string[] extra_info
;
529 protected readonly int code
;
530 protected readonly Location location
;
531 readonly string message
;
533 protected AbstractMessage (int code
, Location loc
, string msg
, ArrayList extraInfo
)
537 this.code
= 8000 - code
;
541 if (extraInfo
.Count
!= 0) {
542 this.extra_info
= (string[])extraInfo
.ToArray (typeof (string));
546 protected AbstractMessage (AbstractMessage aMsg
)
548 this.code
= aMsg
.code
;
549 this.location
= aMsg
.location
;
550 this.message
= aMsg
.message
;
551 this.extra_info
= aMsg
.extra_info
;
558 public override bool Equals (object obj
)
560 AbstractMessage msg
= obj
as AbstractMessage
;
564 return code
== msg
.code
&& location
.Equals (msg
.location
) && message
== msg
.message
;
567 public override int GetHashCode ()
569 return code
.GetHashCode ();
572 public abstract bool IsWarning { get; }
574 public Location Location
{
575 get { return location; }
578 public abstract string MessageType { get; }
580 public string[] RelatedSymbols
{
581 get { return extra_info; }
585 get { return message; }
589 sealed class WarningMessage
: AbstractMessage
591 public WarningMessage (int code
, Location loc
, string message
, ArrayList extra_info
)
592 : base (code
, loc
, message
, extra_info
)
596 public override bool IsWarning
{
600 public override string MessageType
{
607 sealed class ErrorMessage
: AbstractMessage
609 public ErrorMessage (int code
, Location loc
, string message
, ArrayList extraInfo
)
610 : base (code
, loc
, message
, extraInfo
)
614 public ErrorMessage (AbstractMessage aMsg
)
619 public override bool IsWarning
{
620 get { return false; }
623 public override string MessageType
{
631 // Generic base for any message writer
633 public abstract class ReportPrinter
636 /// Whether to dump a stack trace on errors.
638 public bool Stacktrace
;
640 int warnings
, errors
;
642 public int WarningsCount
{
643 get { return warnings; }
646 public int ErrorsCount
{
647 get { return errors; }
650 protected virtual string FormatText (string txt
)
656 // When (symbols related to previous ...) can be used
658 public virtual bool HasRelatedSymbolSupport
{
662 public virtual void Print (AbstractMessage msg
)
670 protected void Print (AbstractMessage msg
, TextWriter output
)
672 StringBuilder txt
= new StringBuilder ();
673 if (!msg
.Location
.IsNull
) {
674 txt
.Append (msg
.Location
.ToString ());
678 txt
.AppendFormat ("{0} CS{1:0000}: {2}", msg
.MessageType
, msg
.Code
, msg
.Text
);
681 output
.WriteLine (FormatText (txt
.ToString ()));
683 output
.WriteLine (txt
.ToString ());
685 if (msg
.RelatedSymbols
!= null) {
686 foreach (string s
in msg
.RelatedSymbols
)
687 output
.WriteLine (s
+ msg
.MessageType
+ ")");
693 // Default message recorder, it uses two types of message groups.
694 // Common messages: messages reported in all sessions.
695 // Merged messages: union of all messages in all sessions.
697 // Used by the Lambda expressions to compile the code with various
698 // parameter values, or by attribute resolver
700 class SessionReportPrinter
: ReportPrinter
702 ArrayList session_messages
;
704 // A collection of exactly same messages reported in all sessions
706 ArrayList common_messages
;
709 // A collection of unique messages reported in all sessions
711 ArrayList merged_messages
;
713 public override void Print (AbstractMessage msg
)
716 // This line is useful when debugging recorded messages
718 // Console.WriteLine ("RECORDING: {0} {1} {2}", code, location, message);
720 if (session_messages
== null)
721 session_messages
= new ArrayList ();
723 session_messages
.Add (msg
);
728 public void EndSession ()
730 if (session_messages
== null)
734 // Handles the first session
736 if (common_messages
== null) {
737 common_messages
= new ArrayList (session_messages
);
738 merged_messages
= session_messages
;
739 session_messages
= null;
744 // Store common messages if any
746 for (int i
= 0; i
< common_messages
.Count
; ++i
) {
747 AbstractMessage cmsg
= (AbstractMessage
) common_messages
[i
];
748 bool common_msg_found
= false;
749 foreach (AbstractMessage msg
in session_messages
) {
750 if (cmsg
.Equals (msg
)) {
751 common_msg_found
= true;
756 if (!common_msg_found
)
757 common_messages
.RemoveAt (i
);
761 // Merge session and previous messages
763 for (int i
= 0; i
< session_messages
.Count
; ++i
) {
764 AbstractMessage msg
= (AbstractMessage
) session_messages
[i
];
765 bool msg_found
= false;
766 for (int ii
= 0; ii
< merged_messages
.Count
; ++ii
) {
767 if (msg
.Equals (merged_messages
[ii
])) {
774 merged_messages
.Add (msg
);
778 public bool IsEmpty
{
780 return merged_messages
== null && common_messages
== null;
785 // Prints collected messages, common messages have a priority
787 public bool Merge (ReportPrinter dest
)
789 ArrayList messages_to_print
= merged_messages
;
790 if (common_messages
!= null && common_messages
.Count
> 0) {
791 messages_to_print
= common_messages
;
794 if (messages_to_print
== null)
797 foreach (AbstractMessage msg
in messages_to_print
)
804 class StreamReportPrinter
: ReportPrinter
806 readonly TextWriter writer
;
808 public StreamReportPrinter (TextWriter writer
)
810 this.writer
= writer
;
813 public override void Print (AbstractMessage msg
)
820 class ConsoleReportPrinter
: StreamReportPrinter
822 static readonly string prefix
, postfix
;
824 static ConsoleReportPrinter ()
826 string term
= Environment
.GetEnvironmentVariable ("TERM");
827 bool xterm_colors
= false;
833 if (Environment
.GetEnvironmentVariable ("COLORTERM") != null){
845 if (!(UnixUtils
.isatty (1) && UnixUtils
.isatty (2)))
848 string config
= Environment
.GetEnvironmentVariable ("MCS_COLORS");
850 config
= "errors=red";
851 //config = "brightwhite,red";
854 if (config
== "disable")
857 if (!config
.StartsWith ("errors="))
860 config
= config
.Substring (7);
862 int p
= config
.IndexOf (",");
864 prefix
= GetForeground (config
);
866 prefix
= GetBackground (config
.Substring (p
+1)) + GetForeground (config
.Substring (0, p
));
867 postfix
= "\x001b[0m";
870 public ConsoleReportPrinter ()
871 : base (Console
.Error
)
875 public ConsoleReportPrinter (TextWriter writer
)
880 static int NameToCode (string s
)
905 // maps a color name to its xterm color code
907 static string GetForeground (string s
)
911 if (s
.StartsWith ("bright")) {
917 return "\x001b[" + highcode
+ (30 + NameToCode (s
)).ToString () + "m";
920 static string GetBackground (string s
)
922 return "\x001b[" + (40 + NameToCode (s
)).ToString () + "m";
925 protected override string FormatText (string txt
)
928 return prefix
+ txt
+ postfix
;
933 static string FriendlyStackTrace (StackTrace t
)
935 StringBuilder sb
= new StringBuilder ();
937 bool foundUserCode
= false;
939 for (int i
= 0; i
< t
.FrameCount
; i
++) {
940 StackFrame f
= t
.GetFrame (i
);
941 MethodBase mb
= f
.GetMethod ();
943 if (!foundUserCode
&& mb
.ReflectedType
== typeof (Report
))
946 foundUserCode
= true;
950 if (f
.GetFileLineNumber () > 0)
951 sb
.AppendFormat ("(at {0}:{1}) ", f
.GetFileName (), f
.GetFileLineNumber ());
953 sb
.AppendFormat ("{0}.{1} (", mb
.ReflectedType
.Name
, mb
.Name
);
956 foreach (ParameterInfo pi
in mb
.GetParameters ()) {
961 sb
.Append (TypeManager
.CSharpName (pi
.ParameterType
));
966 return sb
.ToString ();
969 public override void Print (AbstractMessage msg
)
974 Console
.WriteLine (FriendlyStackTrace (new StackTrace (true)));
977 public static string FriendlyStackTrace (Exception e
)
979 return FriendlyStackTrace (new StackTrace (e
, true));
982 public static void StackTrace ()
984 Console
.WriteLine (FriendlyStackTrace (new StackTrace (true)));
988 public enum TimerType
{
998 public enum CounterType
{
1007 static DateTime
[] timer_start
;
1008 static TimeSpan
[] timers
;
1009 static long[] timer_counters
;
1010 static long[] counters
;
1014 timer_start
= new DateTime
[(int) TimerType
.CountTimers
];
1015 timers
= new TimeSpan
[(int) TimerType
.CountTimers
];
1016 timer_counters
= new long [(int) TimerType
.CountTimers
];
1017 counters
= new long [(int) CounterType
.CountCounters
];
1019 for (int i
= 0; i
< (int) TimerType
.CountTimers
; i
++) {
1020 timer_start
[i
] = DateTime
.Now
;
1021 timers
[i
] = TimeSpan
.Zero
;
1025 [Conditional("TIMER")]
1026 static public void IncrementCounter (CounterType which
)
1028 ++counters
[(int) which
];
1031 [Conditional("TIMER")]
1032 static public void StartTimer (TimerType which
)
1034 timer_start
[(int) which
] = DateTime
.Now
;
1037 [Conditional("TIMER")]
1038 static public void StopTimer (TimerType which
)
1040 timers
[(int) which
] += DateTime
.Now
- timer_start
[(int) which
];
1041 ++timer_counters
[(int) which
];
1044 [Conditional("TIMER")]
1045 static public void ShowTimers ()
1047 ShowTimer (TimerType
.FindMembers
, "- FindMembers timer");
1048 ShowTimer (TimerType
.TcFindMembers
, "- TypeContainer.FindMembers timer");
1049 ShowTimer (TimerType
.MemberLookup
, "- MemberLookup timer");
1050 ShowTimer (TimerType
.CachedLookup
, "- CachedLookup timer");
1051 ShowTimer (TimerType
.CacheInit
, "- Cache init");
1052 ShowTimer (TimerType
.MiscTimer
, "- Misc timer");
1054 ShowCounter (CounterType
.FindMembers
, "- Find members");
1055 ShowCounter (CounterType
.MemberCache
, "- Member cache");
1056 ShowCounter (CounterType
.MiscCounter
, "- Misc counter");
1059 static public void ShowCounter (CounterType which
, string msg
)
1061 Console
.WriteLine ("{0} {1}", counters
[(int) which
], msg
);
1064 static public void ShowTimer (TimerType which
, string msg
)
1067 "[{0:00}:{1:000}] {2} (used {3} times)",
1068 (int) timers
[(int) which
].TotalSeconds
,
1069 timers
[(int) which
].Milliseconds
, msg
,
1070 timer_counters
[(int) which
]);
1074 public class InternalErrorException
: Exception
{
1075 public InternalErrorException (MemberCore mc
, Exception e
)
1076 : base (mc
.Location
+ " " + mc
.GetSignatureForError (), e
)
1080 public InternalErrorException ()
1081 : base ("Internal error")
1085 public InternalErrorException (string message
)
1090 public InternalErrorException (string message
, params object[] args
)
1091 : base (String
.Format (message
, args
))
1094 public InternalErrorException (Exception e
, Location loc
)
1095 : base (loc
.ToString (), e
)
1101 /// Handles #pragma warning
1103 public class WarningRegions
{
1105 abstract class PragmaCmd
1109 protected PragmaCmd (int line
)
1114 public abstract bool IsEnabled (int code
, bool previous
);
1117 class Disable
: PragmaCmd
1120 public Disable (int line
, int code
)
1126 public override bool IsEnabled (int code
, bool previous
)
1128 return this.code
== code
? false : previous
;
1132 class DisableAll
: PragmaCmd
1134 public DisableAll (int line
)
1137 public override bool IsEnabled(int code
, bool previous
)
1143 class Enable
: PragmaCmd
1146 public Enable (int line
, int code
)
1152 public override bool IsEnabled(int code
, bool previous
)
1154 return this.code
== code
? true : previous
;
1158 class EnableAll
: PragmaCmd
1160 public EnableAll (int line
)
1163 public override bool IsEnabled(int code
, bool previous
)
1170 ArrayList regions
= new ArrayList ();
1172 public void WarningDisable (int line
)
1174 regions
.Add (new DisableAll (line
));
1177 public void WarningDisable (Location location
, int code
, Report Report
)
1179 if (Report
.CheckWarningCode (code
, location
))
1180 regions
.Add (new Disable (location
.Row
, code
));
1183 public void WarningEnable (int line
)
1185 regions
.Add (new EnableAll (line
));
1188 public void WarningEnable (Location location
, int code
, Report Report
)
1190 if (Report
.CheckWarningCode (code
, location
))
1191 regions
.Add (new Enable (location
.Row
, code
));
1194 public bool IsWarningEnabled (int code
, int src_line
)
1197 foreach (PragmaCmd pragma
in regions
) {
1198 if (src_line
< pragma
.Line
)
1201 result
= pragma
.IsEnabled (code
, result
);