summaryrefslogtreecommitdiff
path: root/giscanner/transformer.py
Commit message (Collapse)AuthorAgeFilesLines
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-25/+20
| | | | | | | | | | | | | | | | | Version in our tree is a wee bit outdated. For example, later work will introduce an utf8 encoded python source file which our old pep8.py does not yet understand (yeah, it really was *that* ancient)... Updated from: https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py Takes 552c1f1525e37a30376790151c1ba437776682c5, f941537d1c0a40f0906490ed160db6c79af572d3, 5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and a17f157e19bd6792c00321c8020dca5e5a281f45 into account... https://bugzilla.gnome.org/show_bug.cgi?id=699535
* transformer: Remove annotationsJasper St. Pierre2013-05-071-4/+0
| | | | | | | The transformer doesn't need the annotations, so why are we giving it to it? https://bugzilla.gnome.org/show_bug.cgi?id=699854
* giscanner: prefer "except X as e" over "except X, e"Dieter Verfaillie2013-04-091-12/+12
| | | | | | It's more readable and as an added bonus Python 3 compatible. https://bugzilla.gnome.org/show_bug.cgi?id=697616
* scanner: Don't re-parse includes we already foundColin Walters2013-02-271-2/+3
| | | | | | | This fixes the Pango build where it has a chain of two --include-uninstalled. https://bugzilla.gnome.org/show_bug.cgi?id=694593
* scanner: internals cleanup: Move pkgconfig list to NamespaceColin Walters2013-02-261-1/+1
| | | | Continuation of previous work.
* scanner: internals cleanup: Key more things off NamespaceColin Walters2013-02-261-17/+14
| | | | | | | | | | | The .gir format has a weird legacy where stuff like the includes are outside of the <namespace>. But conceptually they're tied together, so let's start reflecting this in the code. This way we can just pass around and look at a Namespace object instead of a 4-tuple of (namespace, includes, c_includes, pkg_config). https://bugzilla.gnome.org/show_bug.cgi?id=694593
* scanner: Synthesize argument names if we don't see oneColin Walters2013-02-261-6/+10
| | | | | | | While this is a bit lame, we need to do something. We preserve the warning message. https://bugzilla.gnome.org/show_bug.cgi?id=694593
* scanner: Fix use of undeclared variable in previous commitColin Walters2013-02-071-1/+1
| | | | Fixes the NetworkManager build.
* transformer: Ensure that types aren't resolved if we can't find themJasper St. Pierre2013-02-071-4/+26
| | | | | | | | This ensures that things can't try to reference undefined/invalid types without emitting warnings, and that users need to include other GIRs at build time if they want to reference another type. https://bugzilla.gnome.org/show_bug.cgi?id=693098
* transformer: Warn on unnamed params in declarationsJasper St. Pierre2013-02-071-5/+9
| | | | | | | These params are unannotatable and undocumentable. They really should not be allowed. https://bugzilla.gnome.org/show_bug.cgi?id=693098
* giscanner: Apply standard annotations to constant valuesJasper St. Pierre2013-02-011-4/+1
| | | | | | | | | | While there's no particular reason I need to do this, there really isn't any reason to not do this, and it helps with doctool or whatever in the future if we want to document when a constant showed up. g-ir-compiler also keeps track of constant deprecations, so this fixes constants not ever being deprecated. https://bugzilla.gnome.org/show_bug.cgi?id=693040
* giscanner: remove unused variablesDieter Verfaillie2012-11-281-2/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=688897
* scanner: Ignore #defines starting with _Colin Walters2012-10-271-0/+3
| | | | | | | | | This matches our behavior for symbols (and we should probably fix this more globally...I think we still scan _-prefixed enums). Noticed from gudev which had #define _GUDEV_INSIDE_H 1 https://bugzilla.gnome.org/show_bug.cgi?id=674072
* giscanner: Don't prefer identifier prefixes over namespaces in depsStef Walter2012-10-231-1/+2
| | | | | Use namespaces in dependencies before falling back to the deprecated --identifier-prefix prefixes.
* scanner: Deprecate using identifier prefixes in GINamesColin Walters2012-10-231-3/+7
| | | | | | | | Instead of crashing. For more details, see the attached bug. Based on a patch by Stef Walter <stefw@gnome.org>. https://bugzilla.gnome.org/show_bug.cgi?id=684370
* scanner: handle unsigned properly for type of defined sizeAlban Browaeys2012-08-031-1/+17
|
* giscanner: special case G_GINT64_CONSTANT and G_GUINT64_CONSTANT + miscAlban Browaeys2012-08-031-1/+4
| | | | | | | | | This let the macro expands to its value as gint64/guint64. Also - fix lexer identifier/typdef detection for macro and misc - do not discard cast
* scanner: Ensure "complete_ctype" patch doesn't throw an exception for ↵Colin Walters2012-07-081-0/+2
| | | | | | | | anonymous unions The previous patch introduced a regression where we would crash on encountering an anonymous union. Work around this by just writing out 'gpointer' in this case, and add a regression test.
* giscanner: Write detailed information in "type" tag's "c:type" attribute.Krzesimir Nowak2012-07-071-15/+69
| | | | | | | | That is - write also type qualifiers (const and volatile here). Update existing tests and add a new struct to regress.h having members with type qualifiers. https://bugzilla.gnome.org/show_bug.cgi?id=656445
* scanner: Turn dead code into assertionColin Walters2012-07-061-2/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=656445
* scanner: Don't use an O(N) lookup when we already have a hashmapJasper St. Pierre2012-06-281-7/+4
| | | | This is a general code cleanup.
* Add constant value annotationJohan Dahlin2011-09-141-1/+2
| | | | | Add an annotation tag "Value:" which can be used on constants to override the value.
* scanner: correctly handle structs with arrays of anon unionsTorsten Schönfeld2011-09-111-11/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This applies mainly to GValue, which is defined as: struct _GValue { /*< private >*/ GType g_type; /* public for GTypeValueTable methods */ union { gint v_int; guint v_uint; glong v_long; gulong v_ulong; gint64 v_int64; guint64 v_uint64; gfloat v_float; gdouble v_double; gpointer v_pointer; } data[2]; }; Previously, the scanner did not understand the array of unions. This resulted in g_struct_info_get_size returning an incorrect size for GValue (at least on 32bit systems). Fix this by making up a separate union declaration for the GIR that can be referenced by the array. https://bugzilla.gnome.org/show_bug.cgi?id=657040
* Windows port: Do not append '/usr/share' to _xdg_data_dirs...Dieter Verfaillie2011-09-071-2/+6
| | | | | | | ... on Windows as it points to the MinGW installation directory, which doesn't have any .gir files to start with anyway. https://bugzilla.gnome.org/show_bug.cgi?id=620566
* giscanner: Allow passing additional include dirs when parsing a girTomeu Vizoso2011-08-151-1/+3
|
* Use a classmethod and s/Transformer/cls/ + s/transformer/self/Johan Dahlin2011-08-111-9/+9
|
* [docbook] Add "Details" title above all methods.Laszlo Pandy2011-08-111-0/+1
|
* [docbook] Make DocBookWriter use TransformerLaszlo Pandy2011-08-111-0/+9
|
* Make the Transformer respect 'skip' annotationsStef Walter2011-08-101-1/+8
| | | | | | * In order to suppress unnecessary warnings on macros which are skipped at later passes of the scanning, we use the annotations to skip AST stuff being created for symbols that are skipped.
* Kill off config.pyColin Walters2011-07-271-3/+2
| | | | | Generating Python source code is problematic for srcdir != builddir; steal a the trick of putting global data in __builtins__ from jhbuild.
* Make caller-allocates detection work for struct aliasesPavel Holejsovsky2011-01-131-7/+10
| | | | | | | | | | | | Scanner tries to detect caller-allocates attribute automatically if not explicitly specified by checking that parameter is not double-referenced and is struct or union. This patch adds resolving of aliases when checking whether parameter is struct or union. Also removes old incorrect method transformer.follow_aliases, which was never used in current code. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=639081
* Add proper unicode support to the source scannerJohan Dahlin2010-12-021-1/+1
| | | | | | The assumption is that the only allowed source encoding is utf-8. Always strings as unicode and fix up the transformer and xml writer to properly output utf-8.
* Fix --include-uninstalledColin Walters2010-09-281-3/+3
| | | | | Somehow, this regressed; i have no idea how. We need to be comparing Include objects, not string versus Include.
* [scanner] Make sure private enums are filteredJohan Dahlin2010-09-261-2/+2
| | | | This is a follow-up to 60a8c75 which wasn't properly fixed.
* [scanner] Mark enum members as private in transformerJohan Dahlin2010-09-261-1/+1
| | | | | | | Remove enum members which follows /* <private> */ comments inside the transformer instead of the sourcescanner itself. Fixes a crash when creating the gir for GstBase.
* Revert "[transformer] Ignore hidden symbols"Johan Dahlin2010-09-211-2/+3
| | | | This reverts commit ad4934ca1d44285ab46d6e419d1788b886e48d82.
* [transformer] Ignore hidden symbolsJohan Dahlin2010-09-201-3/+2
| | | | Do not warn about hidden symbols.
* [scanner] Support private/public directivesJohan Dahlin2010-09-201-1/+8
| | | | Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
* [scanner] Only store types in cache storeJohan Dahlin2010-09-201-3/+13
| | | | | | | | | | | | Only store types that can be referenced in the cache store this reduces the size of the serialized Gtk-3.0.gir in the store from 5.7M to 366k on my system. It also reduces the time it takes to create a gir in gtksourceview by 35% and the time to run the warnings test by more than 50% This also disables the cache for passthrough mode since it needs access to the whole serialized tree.
* scanner: Add temporary workaround for GStreamerColin Walters2010-09-151-0/+4
| | | | | | | Also document/bug link the other workarounds; just made up a convention for ## WORKAROUND ## See: https://bugzilla.gnome.org/show_bug.cgi?id=550616
* scanner: Add c_type for callbacksColin Walters2010-09-141-1/+2
| | | | | | | We weren't doing this consistently, which broke nsname != cprefix cases. https://bugzilla.gnome.org/show_bug.cgi?id=629683
* scanner: Handle G_TYPE_HASH_TABLEColin Walters2010-09-141-5/+6
| | | | | Our Type creation from GType names didn't know how to handle the GObject boxeds for GHashTable, GArray etc.
* scanner: Skip functions with leading '_'Colin Walters2010-09-091-0/+3
| | | | | Multiple modules have '_' prefixed symbols in "public" headers meaning "don't use this in your app".
* scanner: Kill glibastColin Walters2010-09-081-9/+7
| | | | | | | | | | | | It was a stupid abstraction split, we only support GObject. * Clean up how we handle c:type - we only set it if we've actually seen a corresponding structure. * Add a warning if we don't see the structure typedef for an interface, since that's pretty bogus. (And fix regress.h to have one) * Rename the "type_name" attribute internally to "gtype_name" for clarity.
* Handle casing better for constantsOwen W. Taylor2010-09-071-14/+5
| | | | | | | | | | | | | | | | | Instead of handling constants by lower-casing them, stripping the lower-case prefix and upper-casing them again, leave them in the original case and check against upper-cased versions of namespace.symbol_prefixes. Wwe detect what version to test against by looking at the first character of the identifier, so we assume that --symbol-prefix options are always in lowercase. If that needs to be relaxed, then we'll have to check all symbols against both sets of prefixes. Add tests for constants to Regress.h and fix tests/warn/unresolved-type.h for a warning message that improved with this change. https://bugzilla.gnome.org/show_bug.cgi?id=629007
* scanner: Fall back to searching all includes when uncertainColin Walters2010-09-071-1/+14
| | | | | | | | The scanner by default tries hard to ensure that we know immediately from seeing an identifier "FooBarBaz" that the namespace is "Foo". But libraries using --accept-unprefixed here screws this over. Potentially we could add --unstripped-identifier-prefix, but it's ugly. The best long term fix is to fix the namespacing in the library.
* scanner: Don't clear out ctype on annotation strings if we fail to resolveColin Walters2010-09-031-2/+3
| | | | | We don't have an "annotation source" for Type right now; so as a quick hack, stuff it in the ctype but only if we fail to resolve.
* [scanner] Move a function from transformer to astJohan Dahlin2010-09-021-10/+0
| | | | | It doesn't use any internal state, so it can easily be moved over to the type as a factory function
* [test] Add warning tests for enumsJohan Dahlin2010-09-021-3/+3
|
* [scanner] Improve an error message, include linenoJohan Dahlin2010-09-021-1/+1
|