[vala] Do not use verbose error reporting for deprecation warnings
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Do not use verbose error reporting for deprecation warnings
- Date: Sat, 29 Jan 2011 07:16:51 +0000 (UTC)
commit b6021a22cd131139aeab89fe1389fe5d7dde02ee
Author: Jürg Billeter <j bitron ch>
Date: Fri Jan 28 23:50:29 2011 +0100
Do not use verbose error reporting for deprecation warnings
vala/valareport.vala | 22 ++++++++++++++++++++++
vala/valasymbol.vala | 2 +-
2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/vala/valareport.vala b/vala/valareport.vala
index 14e3583..81b3aa7 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 eb3b434..0ffd872 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 {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]