summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-09-29 13:55:29 -0400
committerColin Walters <walters@verbum.org>2010-09-29 14:26:30 -0400
commitef84d840a7822c20f30fe7a93526713acfabd57a (patch)
treed479c8318ea47dd5e1c99ef7f4691396c57d2e11
parentefa132538fde19eb2ce5e93866bbbff26a0d09ff (diff)
downloadgobject-introspection-ef84d840a7822c20f30fe7a93526713acfabd57a.tar.gz
scanner: Abort if we would be generating an empty namespace
Kind of silly we weren't doing this before; an empty namespace is always going to be unintentional. The "oops I forgot to include .h" files actually happened with Clutter, but it wasn't caught since the build didn't obviously fail.
-rw-r--r--giscanner/maintransformer.py6
-rw-r--r--tests/warn/unresolved-type.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index e45ff795..89f7ff65 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -47,6 +47,12 @@ class MainTransformer(object):
# Public API
def transform(self):
+ contents = list(self._namespace.itervalues())
+ if len(contents) == 0:
+ message.fatal("""Namespace is empty; likely causes are:
+* Not including .h files to be scanned
+* Broken --identifier-prefix
+""")
## WORKAROUND ##
# Dirty hack for now...maybe eventually we'll support the "typedef GSList FooSet"
# pattern.
diff --git a/tests/warn/unresolved-type.h b/tests/warn/unresolved-type.h
index a31db5ea..d20182c8 100644
--- a/tests/warn/unresolved-type.h
+++ b/tests/warn/unresolved-type.h
@@ -17,3 +17,7 @@ typedef enum {
} TestMyEnum2;
// EXPECT:17: Warning: Test: symbol='TestMyEnum2': Unknown namespace for symbol 'MY_ENUM_A'
+
+/* Stub function here so namespace isn't empty */
+void test_foo (void);
+