aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Process global enums in declaration orderMatthew Woehlke2015-02-191-3/+2
| | | | | | | | | | In the same vein as the previous commit, process global enums in order added (which presumably is declaration order). For what we're doing at this point, this may not be as critical, but again is needed to avoid a spurious test failure. Change-Id: If32a07fee2e7e9b7699e01eda3408ed57855e947 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Return enums in declaration order (order added)Matthew Woehlke2015-02-192-2/+10
| | | | | | | | | | | | | Modify _ScopeModelItem to return enums (from the enums() method) in the order that they were added (which presumably is the order in which they were declared). We must do this because we must process enumerations in the same order in order to resolve values, as later declared enums may refer to values from earlier declared enums (and in fact, this is exactly the case in the 'testenum' test), and the order we get just from QHash may not match declaration order. Change-Id: I15a05df98a2cee7ecccb6c82d3f9017735281245 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Version bumpJohn Ehresman2014-04-221-1/+1
| | | | | Change-Id: I4da6558dfa2dd2aaae6343d2363b7fcfc7786f45 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Remove rejection lines that cause the sample_list test to failJohn Cummings2014-04-171-6/+0
| | | | | | | | | | | These functions (except createComplexList) are are needed by the test. Prior to 5b39f7fd9e21, the rejections were not being recognized; removing them returns the wrappings to their previous state and allows the test to pass again. Change-Id: I3efb08383b2d59f9917a4e4a0200e0516db9c83e Reviewed-by: Matthew Woehlke <mw_triad@users.sourceforge.net> Reviewed-by: John Ehresman <jpe@wingware.com>
* Remove protected from samblebinding testJohn Ehresman2014-04-161-2/+1
| | | | | | | | | The protected sections triggered a generation bug when avoiding the protected hack Change-Id: I6346cdb74a25f1ddf49263d9f74670a3b105b07a Reviewed-by: Matthew Woehlke <mw_triad@users.sourceforge.net> Reviewed-by: Roman Lacko <backup.rlacko@gmail.com>
* Add parsing of 'noexcept' keywordMatthew Woehlke2014-04-166-0/+57
| | | | | | | | | | | Teach Shiboken to parse the 'noexcept' keyword. This doesn't add any features (and we only support unconditional 'noexcept' for now), but addresses an internal error that causes shiboken to SEGV trying to parse modern versions of boost::intrusive_ptr. A test case to replicate the crash (without the other changes) is also added. Change-Id: I4713593dfd189c02ef4a2d7447d785b6d378019c Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix function rejections (i.e. support overloads)Matthew Woehlke2014-04-164-0/+33
| | | | | | | | | | | | | | | | | | | | | Add an additional check to AbstractMetaBuilder::traverseFunction to also perform a quick-and-dirty construction of the function signature, and to check that against the rejections. Add a unit test for matching full signatures. Before, we were only testing the function name; as a result, a rejection like 'foo()' would never match (because the name does not have ()'s). This is especially helpful for rejecting specific overloads of functions while allowing others to be wrapped normally. (The unit test shows a not-so-far-fetched example why one might want to do this.) The signature building logic isn't very sophisticated and likely requires a very exacting match to the signature as it appears in the wrapped sources, but that's likely not a serious issue, and at any rate this is much better than not being able to match overloads at all. Change-Id: Ic686377477aacf54f79c7bd2013e9aea8521a4ea Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix building with python 3.3 and 3.4.Hugo Osvaldo Barrera2014-04-151-1/+1
| | | | | | | | | | | | | | | FindPython3Libs.cmake lists hardcoded versions of python3 to look for, which include up to python 3.2. Added python 3.3 and 3.4 to this list so that building on these versions works. A better solution would be ideal in future, so as to avoid having to add python versions to this list as time passes. However, this fixes the issue for now. Change-Id: I9c113f70164c30dc3a94a5c946facbc38901f68e Reviewed-by: John Ehresman <jpe@wingware.com>
* doc: Stop requiring sphinx.ext.refcounting.Raphael Kubo da Costa2014-03-241-1/+1
| | | | | | | | | | | | | Sphinx 1.2 made a backwards-incompatible change and removed its `refcounting' extension module because it "is very specific to CPython and has no place in the main distribution". Fix the build with Sphinx 1.2+ by not requiring it in conf.py.in; we were not using it before anyway (the `refcount_file' variable was not set) and it was likely added by default when the configuration file was generated. Change-Id: I6c775fb4c1c2daae25aade68079efc2e77225a0f Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix for containers with 'const' valuesMatthew Woehlke2014-01-075-2/+60
| | | | | | | | | Fix omission of 'const' specifier when generating binding code for containers whose value type is 'const', which would lead to binding code that does not compile due to 'const' mismatch. Includes test case. Change-Id: Iff99a16ee071bb255f78e86e2456e5206cc00cfb Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix compilation issue on OS X 10.9Brian Jensen2013-11-181-0/+10
| | | | | | | | | | | | Starting with OS X 10.9 the system toolchain defaults to libc++. This is a problem with the current sparse hash config as it defaults to using c++11 functionality under the std::tr1 namespace instead of std, which fails for libc++ since it does not implement the tr1 namespace. This change allows libc++ based systems to use the correct namespace. Change-Id: Ia8dd49fb5fad2915f41e44240e45a7af9d6453a8 Reviewed-by: John Ehresman <jpe@wingware.com>
* Only use fields in PyTypeObject when defining typesJohn Ehresman2013-11-141-12/+27
| | | | | | | | | | | Allocate and use separate structures for as_* fields in the PyTypeObject rather than using fields in the PyHeapTypeObject. This is a step away from using the PyHeapTypeObject, which is unnecessary and will make supporting stackless python easier. Change-Id: I6e5c514ab6db5b8bee9bee3107b97d6fbd582641 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix buffer overrun processing macro definitionsMatthew Woehlke2013-10-151-0/+2
| | | | | | | | | | | | | | Fix potential buffer overrun (__first iterator becomes > __last and starts processing garbage) when parsing macro definitions that would occur if a macro definition ends in a comment. This would cause the macro definition to contain incorrect content or even outright garbage (i.e. random memory) if the trailing comment is at the end of the file, as in boost/type_traits/detail/type_trait_def.hpp. In this worst case, the macro expansion could contain a NUL byte which would cause parsing to prematurely halt at the point of expansion. Change-Id: I94ded39d9a20dc9510d827bc18adb2dc1bad17f0 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix 'special' include handlingMatthew Woehlke2013-10-091-1/+1
| | | | | | | | | Fix handling of includes like '#include BOOST_USER_CONFIG'. This was failing due to an obvious logic error in how the preprocessor tests if the expanded symbol looks like an include file location. Change-Id: Ia085e5c081078d328d6fc84ff2a99681913a30b9 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Don't warn when inheriting from containerMatthew Woehlke2013-10-092-7/+10
| | | | | | | | | | Change AbstractMetaBuilder::setupInheritance to not warn about classes that inherit from known container types, even if the container type does not have a corresponding wrapper class (which in many or most cases it won't). Remove now-unneeded suppression for the same in 'sample'. Change-Id: I0a45636791eba36cf070ea082eb6ead6cb5947ef Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix finding container base classesMatthew Woehlke2013-10-092-32/+64
| | | | | | | | | | | | | | | Move logic to find template classes to its own helper method, and newly use the helper in AbstractMetaBuilder::getBaseClasses. This fixes the latter not finding template base classes, which fixes class topological sorting in some cases. Unfortunately I have not figured out a reliable unit test for this, although printing a debug warning when finding the parent fails (or when a template lookup succeeds) is able to verify that this change is doing something useful. Change-Id: I2a5e0df4035393288b6f69ebc41dc0e64866a182 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Revert "Remove useless code."Matthew Woehlke2013-10-091-0/+3
| | | | | | | | | | | | | | This reverts commit 02c6e63ac8dbb8acde3bc19abd36fff0db65fd11. Apparently types derived from containers can have a container base class without the container class having a metaclass. This fixes the sample_strlist unit test crashing. (There may be another bug here, in Shiboken's don't-write-generated-source-if-not-changed logic, as the failure doesn't seem to reliably appear/disappear after an incremental build.) Change-Id: I5f60bfb784dca02d9766a32e7b7b8a8a529df5af Reviewed-by: John Ehresman <jpe@wingware.com>
* Refactor and improve added function resolvingMatthew Woehlke2013-09-265-14/+151
| | | | | | | | | | | | | | | | | | | | | | | | | Add a public function to create an AddedFunction::TypeInfo from a signature string. Change translateType to use this to do full recursive resolution on template arguments. Create a new helper function to do more intelligent parsing of template type name signatures, and use this in translateType. Taken together, this means that we now recognize both multiple arguments to template types of added functions, as well as template arguments that are themselves template types. We couldn't do this before due to the use of a regular expression to attempt to separate the template type name from its arguments. The test cases are updated to test these new features. Note, however, that it is now a fatal error if the template argument type cannot be determined. (Before we would just drop it and treat the type as a non-container.) However, 1) this should not be happening in a well formed type system, and 2) it's questionable if things wouldn't have fallen apart anyway from treating the presumed container as something else. Change-Id: I23c3a7f7e311e046642d951d6ad2236571fda6b8 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Remove useless code.Matthew Woehlke2013-09-251-3/+0
| | | | | | | | | | | | Remove code to set the type entry base container type in AbstractMetaBuilder::setupInheritance outside of setting up the container meta class. We do it anyway when the meta class is found, and fail if we can't find the meta class, so having just the type entry set is not really useful. (And this will allow us to simplify the code going forward.) Change-Id: I90389efc574d516703df0d6a26ba130769adfea7 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Write inititializations in topological orderMatthew Woehlke2013-09-248-6/+32
| | | | | | | | | | | | | | | | | | Add methods to various places in the hierarchy so that the generator can access the topologically ordered class list (in addition to the unordered class list). Modify CppGenerator::finishGeneration to use this. This fixes a failure to correctly create Python wrapper classes due to subclass wrappers being initialized before their base class (with the result that the looked-up type object for the base class is null, causing the derived class to be created without referencing the base). Also change one of the test cases to test that we correctly wrap a typedef of a template class derived from a non-template base (which was failing before this change for the aforementioned reason). Change-Id: Ib4dc2626a41cb7bb905ff4a302c2613ea12d026b Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Work around MSVC's deficient <cmath>Matthew Woehlke2013-08-141-0/+6
| | | | | | | | Change libsample/transform.cpp to use the MSVC-specific _finite on Windows, rather than std::isfinite, which MSVC does not implement. Change-Id: If7b33e17bcb7c2e4432d670d44b559205f88796d Reviewed-by: John Ehresman <jpe@wingware.com>
* Remove unnecessary line feedMatthew Woehlke2013-08-141-1/+1
| | | | | | | | | | | Remove explicit '\n' from echo command in 'dist' target. This isn't needed (echo should output one regardless, so it only creates an additional empty line), and it is being parsed by CMake, which results in generating a build.ninja on at least Windows that cannot be parsed due to an unterminated string. Change-Id: I5d8aba12c71f5a9c29a07108c50499081ba7203a Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix description of sample/transform unit testMatthew Woehlke2013-08-061-1/+1
| | | | | Change-Id: I942d2f450c8c57bed779925636a9abae572da98c Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Clean up styleMatthew Woehlke2013-08-061-18/+19
| | | | | | | | Change wrapping and indent of some code in Handler::startElement to improve consistency. Change-Id: I13bae6bbb732e3c5791cf0079154feed8d8dcbd1 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Updated authors fileJohn Ehresman2013-07-301-0/+4
| | | | | | Change-Id: I43bc9ad2b32fc24bdbbc38728ae34e60ea843103 Reviewed-by: Roman Lacko <backup.rlacko@gmail.com> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix '%#' substitution for # > 9Matthew Woehlke2013-07-307-2/+172
| | | | | | | | | | | | Change '%#' substitution to use a regular expression for the 'old' text to enforce a word boundary after '#', such that we don't perform e.g. '%1' replacement on inputs like '%10'. This fixes problems trying to modify functions with more than nine arguments, such as the example from the previous commit (which now compiles and passes). Also add a test case for this. Change-Id: I9956804b3c65bddf7e36838866641b24ceb87c57 Reviewed-by: John Ehresman <jpe@wingware.com>
* Improve dependencies for testsMatthew Woehlke2013-07-303-10/+7
| | | | | | | | | | | | | | | | | | | | | Add the global header and typesystem XML, and shiboken itself, as dependencies to running Shiboken for generating the wrapped code used in the unit tests. This gives a better example in case of users looking at this code for how to do things in their own projects, and also makes test writing easier by removing the need to do a clean build or touch files to force the wrapping code to be recreated when modifying the test code or the generator. Change command invocation to use shiboken as a target name (CMake will recognize it as a target and use the correct path automatically), and remove the now redundant dependency of the wrapping libraries on the same. (This is superfluous both because using shiboken as a target will cause CMake to add an implicit dependency on it for users of the generated files, but also because it isn't really needed; the generate command having it as a dependency covers needing it built first, and is what we really care about as far as rebuilding anything if it changes.) Change-Id: If5cdf2e98602e500b49ba7b000e4e30e77e1a136 Reviewed-by: John Ehresman <jpe@wingware.com>
* Bump version number to 1.2.1John Ehresman2013-07-221-1/+1
| | | | | | | Change-Id: I96686740c2572818fce36de23cf2c16f127fdda9 Reviewed-by: Roman Lacko <backup.rlacko@gmail.com> Reviewed-by: John Cumming <john@jsolutions.co.uk> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Return None for .name of enum if no name for value.John Ehresman2013-07-122-2/+12
| | | | | | | | | This fixes segfaults when trying to get the name of a dead key from a qt key event. Change-Id: Ie631e2245bca0a3fee8616854f6479d3dec0c2bb Reviewed-by: Roman Lacko <backup.rlacko@gmail.com> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Bump the library version number to 1.2John Ehresman2013-07-011-2/+2
| | | | | | Change-Id: I5dde75c011a976a1da235d11847bdc69014df5df Reviewed-by: Roman Lacko <backup.rlacko@gmail.com> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Removed old logos from html docsJohn Ehresman2013-06-294-4/+2
| | | | | Change-Id: I7b546aa11b7380049c533a44d9c9159edd73d73b Reviewed-by: Roman Lacko <backup.rlacko@gmail.com>
* Add missing return on module init errorMatthew Woehlke2013-06-291-1/+1
| | | | | | | | | Add 'return' before 'SBK_MODULE_INIT_ERROR' when module initialization fails due to a missing dependency. This appears to have been accidentally lost in 0b1f8df512047c6ace60701180ec1e4f6e97484e. Change-Id: I1bc1453c8515e7b67c101c8e8f13a1266d04433f Reviewed-by: John Ehresman <jpe@wingware.com>
* Don't break -Werror=non-virtual-dtorMatthew Woehlke2013-06-283-0/+4
| | | | | | | | | | | | | | Classes with virtual methods but non-virtual destructors are dangerous, because users often hold pointers-to-base-class of derived classes, which cannot correctly destruct the derived class if deleted. As such, there is the aforementioned warning that developers may like to promote to an error. Add virtual (empty) destructors to some classes that were tripping this, so that we build successfully if said flag is used, and because they should probably be present. Change-Id: I930ad5f5d122cf94c57e52bf28479cf3ca7950d4 Reviewed-by: John Cummings <jcummings2@users.sf.net> Reviewed-by: John Ehresman <jpe@wingware.com>
* Fixing shiboken test for minimal binding testStefan Landvogt2013-06-281-2/+8
| | | | | | | Don't execute typedef_test.py, when NumPy is not installed Change-Id: I452944822177f616ea640ed0ee005d0436ab518b Reviewed-by: John Ehresman <jpe@wingware.com>
* Decref reference to type objectJohn Ehresman2013-06-243-19/+46
| | | | | | | | A decref is needed if the type is not subclassed when an instance is deallocated Change-Id: I2c64d7cb5b726c5bf108c1cbc5283cf315a5f8e9 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix segfault when using shiboken.deleteJohn Ehresman2013-06-242-1/+53
| | | | | | | | When an object is deleted, invalidate / releaseWrapper needs to be called before cptr array is deleted. Change-Id: I82f71f569d5a0f52084fbe1cc3d7846e764c7ef6 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Use non-static method def for instance methodsJohn Ehresman2013-06-241-1/+11
| | | | | | | | | | | For methods that can be called as either class or instance methods (e.g. PySide's QObject.connect), a non-static variant of the PyMethodDef struct is needed in Python 3.3 when method is used as an instance method. Fixes https://bugreports.qt-project.org/browse/PYSIDE-145 Change-Id: Ie8876a381614f33815f9b6449ea4a61cde9e5cee Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix bug introduced when recursive_invalidate was added.John Cummings2013-06-242-6/+29
| | | | | | | | | | If a Python object is passed to recursive_invalidate and is a sequence, each item in the sequence is invalidated Add unit test for recursive invalidate of a sequence Change-Id: I70834f8e027bd17a04c0e443bc7d584d1fde26c1 Reviewed-by: John Ehresman <jpe@wingware.com> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* fix build in C++11 modeMatthew Woehlke2013-06-223-17/+17
| | | | | | | | | | | | | | Add spaces between string literals and preprocessor symbols. These are required because C++11 defines string prefix and suffix operators, and confuses preprocessor tokens adjacent to string literals as unrecognized string literal modifies, resulting in compile errors. Some of these changes are also needed to prevent generating code with the same problem (which affects both Shiboken building itself, but also any users of Shiboken). Change-Id: I99f2d3c61fd9df682f915a29f27321fee2ce759e Reviewed-by: John Ehresman <jpe@wingware.com>
* Prevent infinite recursion in invalidateJohn Ehresman2013-06-134-5/+32
| | | | | Change-Id: I8946a8572b608bf8ede211d270f797f135f8083a Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Replaced Nokia copyrights in headerTeemu Kaukoranta2013-05-28461-461/+461
| | | | | | | | | | | | | | | | | | | | | | | | Replaced old Nokia copyrights with Digia copyrights. Removed "All rights reserved" strings without leading copyrights were removed (for example, 'Copyright SomeCompany, all rights reserved remain untouched). Did NOT touch contact details, will change them later. Excluded folders that have '3rdparty' in path. Used command: find . -path '*/3rdparty/*' -prune -o -exec grep -ilI -E '.*Copyright.*Nokia.*' {} \; | tee >(xargs sed -i -r '1,10 s/([ \t#*]*)(.*Copyright.*Nokia.*)/ \1Copyright \(C\) 2013 Digia Plc and\/or its subsidiary\(-ies\)\./I') >(xargs sed -i -r '1,10 s/(^[ \t#*]*)(all rights reserved.*)/\1/I') This excludes binary files and retains whitespace and #* characters in the beginning of the edited lines. Change-Id: I0d49f991c3dbd45d804843f185714e8681bc6c51 Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Janne Anttila <janne.anttila@digia.com>
* Fix possible conflict with garbage collector.Robin Dunn2013-05-131-0/+17
| | | | | | | | | Ensure that the GC is no longer tracking object an object before starting to delete it. Since Shiboken's object deletion goes through several steps we need to ensure that the GC will not try to delete the same object. Change-Id: Ia3337c72204b0ebf524959e1c99fbef7c1a02249 Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix possible crash at exit.Robin Dunn2013-05-081-3/+5
| | | | | | | The interpreter may already be finalized when it gets to ~BindingManager() so ensure that the interpreter is still valid before doing anything that could result in Python being called for a DECREF or etc. Change-Id: I8a68322f404a1dcaa9203923d6f699ed57e9d319 Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix handling of unsigned long long and provide unittests.Sébastien Sablé2013-03-146-2/+60
| | | | | | Change-Id: I29674a2d758ebf4650e2fe26cdc2e663c0bae5c7 Reviewed-by: Sébastien Sablé <sable@users.sourceforge.net> Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Add test to illustrate issue on typedef enumSebastien Sable2013-03-012-0/+34
| | | | | | Change-Id: I0c95a5ba46a3392d5ff6bb5f40d300b07facf7e9 Reviewed-by: Sébastien Sablé <sable@users.sourceforge.net> Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Use getWrapperForQObject to convert if generating for PySideJohn Ehresman2012-12-211-11/+14
| | | | | Change-Id: I4a83bc3642c9853e61597093fb0a7f25fdfec46b Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Allow compilation without a python shared library.John Ehresman2012-12-201-2/+2
| | | | | | | | The use case is compiling against a python built with shared library support disabled. Change-Id: Ic919ebcf7c85261a0275a013ebc1523c1fe5a755 Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Use parent class's metaObject if wrapper is NULL.John Ehresman2012-12-171-0/+2
| | | | | | | | | Return metaObject from parent class if wrapper has been invalidated, which currently happens in the *Wrapper class destructor. Change-Id: I1d5ef8802acf796cced7838b3ecc76f51201d906 Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Optionally assert on free'd pointer with a valid wrapper.John Ehresman2012-12-174-1/+230
| | | | | | | | | | Use a debug mode callback that's called every time free is called to detect wrappers that are still in the binding manager's map after the C++ object is deleted. When it's enabled 10+ of the PySide tests fail. Change-Id: I30a40d48f6c4560ff0a3755d61c26ea4c6dd2758 Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Find python3 libraries when built with pydebug enabledJohn Ehresman2012-12-111-1/+1
| | | | | Change-Id: I5ab48078f8a4468865bc0a961f78d2d578b8f81c Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>