summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: