diff options
author | Stef Walter <stefw@gnome.org> | 2013-04-19 16:18:40 +0200 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-10-21 20:42:10 +0200 |
commit | 917da2d1aeffdc884a5fd5cf5b38a60ef088d0fb (patch) | |
tree | 115a99b4da986468aca556aec5af292626807948 /giscanner/sourcescanner.c | |
parent | ebb80508d6959a0c94351e841c2cab6220602e62 (diff) | |
download | gobject-introspection-917da2d1aeffdc884a5fd5cf5b38a60ef088d0fb.tar.gz |
giscanner: Respect __GI_SCANNER__ when scanning for macros
When scanning for macros respect ifdefs of __GI_SCANNER__
in the various header files. Only #ifdef and #ifndef are supported.
If __GI_SCANNER__ appears in plain #if statements, a warning is
printed.
https://bugzilla.gnome.org/show_bug.cgi?id=698367
Diffstat (limited to 'giscanner/sourcescanner.c')
-rw-r--r-- | giscanner/sourcescanner.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c index 70eca8d0..30c2b036 100644 --- a/giscanner/sourcescanner.c +++ b/giscanner/sourcescanner.c @@ -221,6 +221,7 @@ gi_source_scanner_new (void) scanner->files = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, g_object_unref, NULL); + g_queue_init (&scanner->conditionals); return scanner; } @@ -247,6 +248,7 @@ gi_source_scanner_free (GISourceScanner *scanner) g_hash_table_unref (scanner->files); + g_queue_clear (&scanner->conditionals); } gboolean @@ -268,6 +270,12 @@ void gi_source_scanner_add_symbol (GISourceScanner *scanner, GISourceSymbol *symbol) { + if (scanner->skipping) + { + g_debug ("skipping symbol due to __GI_SCANNER__ cond: %s", symbol->ident); + return; + } + g_assert (scanner->current_file); if (scanner->macro_scan || g_hash_table_contains (scanner->files, scanner->current_file)) @@ -295,6 +303,21 @@ gi_source_scanner_add_symbol (GISourceScanner *scanner, } } +void +gi_source_scanner_take_comment (GISourceScanner *scanner, + GISourceComment *comment) +{ + if (scanner->skipping) + { + g_debug ("skipping comment due to __GI_SCANNER__ cond"); + gi_source_comment_free (comment); + return; + } + + scanner->comments = g_slist_prepend (scanner->comments, + comment); +} + GSList * gi_source_scanner_get_symbols (GISourceScanner *scanner) { |