summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-10-07 16:27:00 -0400
committerColin Walters <walters@verbum.org>2010-10-25 17:04:53 -0400
commitb18c248d2fcb7accc96269341e87eca5cb3ad864 (patch)
tree0afdfa3a33fbc3ab3f772fba638db67c9f7f0bca
parenta09298e2638282e8529c554704a2493006af379f (diff)
downloadgobject-introspection-b18c248d2fcb7accc96269341e87eca5cb3ad864.tar.gz
scanner: Print out a message if warnings were off
Otherwise people may not know about --warn-all. https://bugzilla.gnome.org/show_bug.cgi?id=631644
-rw-r--r--giscanner/message.py10
-rw-r--r--giscanner/scannermain.py6
2 files changed, 10 insertions, 6 deletions
diff --git a/giscanner/message.py b/giscanner/message.py
index ec7ace00..1b0e260c 100644
--- a/giscanner/message.py
+++ b/giscanner/message.py
@@ -74,7 +74,7 @@ class MessageLogger(object):
self._output = output
self._namespace = namespace
self._enable_warnings = False
- self._warned = False
+ self._warning_count = 0
@classmethod
def get(cls, *args, **kwargs):
@@ -85,21 +85,21 @@ class MessageLogger(object):
def enable_warnings(self, enable):
self._enable_warnings = enable
- def did_warn(self):
- return self._warned
+ def get_warning_count(self):
+ return self._warning_count
def log(self, log_type, text, positions=None, prefix=None):
"""Log a warning, using optional file positioning information.
If the warning is related to a ast.Node type, see log_node_warning()."""
utils.break_on_debug_flag('warning')
+ self._warning_count += 1
+
if not self._enable_warnings:
if log_type == FATAL:
raise SystemExit(text)
return
- self._warned = True
-
if type(positions) == set:
positions = list(positions)
if isinstance(positions, Position):
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index fc52715f..dd186435 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -405,9 +405,13 @@ def scanner_main(args):
final = IntrospectablePass(transformer, blocks)
final.validate()
- if options.warn_fatal and logger.did_warn():
+ warning_count = logger.get_warning_count()
+ if options.warn_fatal and warning_count > 0:
message.fatal("warnings configured as fatal")
return 1
+ elif warning_count > 0:
+ print ("g-ir-scanner: %s: warning: %d warnings suppressed (use --warn-all to see them)"
+ % (transformer.namespace.name, warning_count, ))
# Write out AST
if options.packages_export: