[vala] valac: Add --disable-warnings command-line option
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] valac: Add --disable-warnings command-line option
- Date: Sat, 26 Sep 2009 12:47:27 +0000 (UTC)
commit ffe25d65b4ac1ee955807fa1c1f395796feb34a9
Author: Jürg Billeter <j bitron ch>
Date: Sat Sep 26 14:32:50 2009 +0200
valac: Add --disable-warnings command-line option
compiler/valacompiler.vala | 3 +++
vala/valareport.vala | 6 ++++++
2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 3d71084..2b32f9d 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -56,6 +56,7 @@ class Vala.Compiler {
static bool experimental;
static bool non_null_experimental;
static bool disable_dbus_transformation;
+ static bool disable_warnings;
static string cc_command;
[CCode (array_length = false, array_null_terminated = true)]
[NoArrayLength]
@@ -97,6 +98,7 @@ class Vala.Compiler {
{ "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable additional run-time checks", null },
{ "enable-deprecated", 0, 0, OptionArg.NONE, ref deprecated, "Enable deprecated features", null },
{ "enable-experimental", 0, 0, OptionArg.NONE, ref experimental, "Enable experimental features", null },
+ { "disable-warnings", 0, 0, OptionArg.NONE, ref disable_warnings, "Disable warnings", null },
{ "enable-non-null-experimental", 0, 0, OptionArg.NONE, ref non_null_experimental, "Enable experimental enhancements for non-null types", null },
{ "disable-dbus-transformation", 0, 0, OptionArg.NONE, ref disable_dbus_transformation, "Disable transformation of D-Bus member names", null },
{ "cc", 0, 0, OptionArg.STRING, ref cc_command, "Use COMMAND as C compiler command", "COMMAND" },
@@ -186,6 +188,7 @@ class Vala.Compiler {
context.experimental = experimental;
context.non_null_experimental = non_null_experimental;
context.dbus_transformation = !disable_dbus_transformation;
+ context.report.enable_warnings = !disable_warnings;
context.report.set_verbose_errors (!quiet_mode);
context.verbose_mode = verbose_mode;
diff --git a/vala/valareport.vala b/vala/valareport.vala
index 0e839a3..22d689d 100644
--- a/vala/valareport.vala
+++ b/vala/valareport.vala
@@ -31,6 +31,8 @@ public class Vala.Report : Object {
bool verbose_errors;
+ public bool enable_warnings { get; set; default = true; }
+
/**
* Set the error verbosity.
*/
@@ -97,6 +99,10 @@ public class Vala.Report : Object {
* @param message warning message
*/
public virtual void warn (SourceReference? source, string message) {
+ if (!enable_warnings) {
+ return;
+ }
+
warnings++;
if (source == null) {
stderr.printf ("warning: %s\n", message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]