diff options
author | Jürg Billeter <j@bitron.ch> | 2011-01-28 23:50:29 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2011-01-28 23:50:29 +0100 |
commit | b6021a22cd131139aeab89fe1389fe5d7dde02ee (patch) | |
tree | 9bfcceacb52aff13e9b11e899d323b33703cc6a9 /vala | |
parent | fe751a8b7a42cdc42e01c279ce373df72b5d18ad (diff) | |
download | vala-b6021a22cd131139aeab89fe1389fe5d7dde02ee.tar.gz |
Do not use verbose error reporting for deprecation warnings
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valareport.vala | 22 | ||||
-rw-r--r-- | vala/valasymbol.vala | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/vala/valareport.vala b/vala/valareport.vala index 14e358376..81b3aa737 100644 --- a/vala/valareport.vala +++ b/vala/valareport.vala @@ -114,6 +114,25 @@ public class Vala.Report : Object { } /** + * Reports the specified message as deprecation warning. + * + * @param source reference to source code + * @param message warning message + */ + public virtual void depr (SourceReference? source, string message) { + if (!enable_warnings) { + return; + } + + warnings++; + if (source == null) { + stderr.printf ("warning: %s\n", message); + } else { + stderr.printf ("%s: warning: %s\n", source.to_string (), message); + } + } + + /** * Reports the specified message as warning. * * @param source reference to source code @@ -157,6 +176,9 @@ public class Vala.Report : Object { public static void notice (SourceReference? source, string message) { CodeContext.get ().report.note (source, message); } + public static void deprecated (SourceReference? source, string message) { + CodeContext.get ().report.depr (source, message); + } public static void warning (SourceReference? source, string message) { CodeContext.get ().report.warn (source, message); } diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala index eb3b43475..0ffd87206 100644 --- a/vala/valasymbol.vala +++ b/vala/valasymbol.vala @@ -493,7 +493,7 @@ public abstract class Vala.Symbol : CodeNode { public bool check_deprecated (SourceReference? source_ref = null) { if (deprecated) { if (!CodeContext.get ().deprecated) { - Report.warning (source_ref, "%s %s%s".printf (get_full_name (), (deprecated_since == null) ? "is deprecated" : "has been deprecated since %s".printf (deprecated_since), (replacement == null) ? "" : ". Use %s".printf (replacement))); + Report.deprecated (source_ref, "%s %s%s".printf (get_full_name (), (deprecated_since == null) ? "is deprecated" : "has been deprecated since %s".printf (deprecated_since), (replacement == null) ? "" : ". Use %s".printf (replacement))); } return true; } else { |