Commit graph

2,522 commits

Author SHA1 Message Date
Petre Eftime
0a07cd4c30 Prevent redefinition warnings when compiling with SWIG<module> defined
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com>
2015-12-22 14:33:21 +02:00
William S Fulton
adc773455d Merge branch 'missing-initializers'
* missing-initializers:
  Tcl fix when using -Wmissing-field-initializers warnings
  Php fix for -Wmissing-field-initializers warning
  Fixes for Octave and missing -Wmissing-field-initializers in swig_octave_member
  Fixes for Ruby and using -Wmissing-field-initializers
  R test case warning fixes
  Use -Wmissing-field-initializers warning testing all languages on Travis
2015-12-19 16:34:38 +00:00
William S Fulton
e917636575 Tcl fix when using -Wmissing-field-initializers warnings
Only fixed for Tcl >= 8.5 as prior to this version the Tcl_HashTable structure
changed a few times.
2015-12-19 16:21:23 +00:00
William S Fulton
6a61f8271f Php fix for -Wmissing-field-initializers warning
Use ZEND_FE_END (introduced sometime around 5.2) to obtain the correct
number of arguments for zend_function_entry. Fallback to the original
3 argument initializer if not defined, however, this will not fix the
initializer warning though for some older versions of PHP.
2015-12-19 16:21:23 +00:00
William S Fulton
ec8a5c71cb Fixes for Octave and missing -Wmissing-field-initializers in swig_octave_member 2015-12-19 16:21:22 +00:00
William S Fulton
f77839dfbf Initialize missing PyNumberMethods for Python 3.5 and -builtin
Add nb_matrix_multiply nb_inplace_matrix_multiply
2015-12-16 18:32:21 +00:00
William S Fulton
3e27d45b2a Merge branch 'ahnolds-python34'
* ahnolds-python34:
  Python tp_allocs -> tp_next corrections
  Cosmetic correction for Python tp_version -> tp_version_tag
  Add -Wmissing-field-initializers to python Travis testing
  Python 3.3 builtin missing field initializers added
  Adding tp_finalize field to PyTypeObject for Python 3.4 and -builtin
  Adding nb_matrix_multiply and nb_inplace_matrix_multiply fields to PyNumberMethods for Python version 3.5 and up
  Adding tp_finalize field to PyTypeObject for Python version 3.4 and up
2015-12-14 01:59:39 +00:00
William S Fulton
5f93c94e87 Python tp_allocs -> tp_next corrections
Updates for Python 2.5 and later and for -builtin.
2015-12-14 01:56:11 +00:00
William S Fulton
f7b9466dff Python 3.3 builtin missing field initializers added
Add in ht_qualname and ht_cached_keys for Python 3.3 and later
2015-12-14 01:22:41 +00:00
William S Fulton
5724195b8b Adding tp_finalize field to PyTypeObject for Python 3.4 and -builtin 2015-12-14 01:22:41 +00:00
William S Fulton
c5322a9ecb Python use Py_ssize_t instead of int for better portability 2015-12-05 09:00:04 +00:00
William S Fulton
ed044e4b8c Warning fix for Visual Studio 2015-11-28 18:48:52 +00:00
William S Fulton
3d681571e1 Merge pull request #498 from lyze/extend-cffi-typemap-machinery
Implement argout, freearg, and check for CFFI.
2015-10-11 22:11:09 +01:00
William S Fulton
ef001de524 Support Python 3.5 and -builtin.
PyAsyncMethods is a new member in PyHeapTypeObject.
Closes#539
2015-10-10 01:25:52 +01:00
Ian Lance Taylor
7e40e523c3 [Go] Don't emit a constructor function for a director class with an
abstract method, since the function will always panic.

Fixes #435.
2015-10-06 13:55:39 -07:00
William S Fulton
fc2205e64d %shared_ptr support improvements for classes in an inheritance chain
Fix %shared_ptr support for private and protected inheritance.
- Remove unnecessary Warning 520: Derived class 'Derived' of 'Base'
  is not similarly marked as a smart pointer
- Do not generate code that attempts to cast up the inheritance chain in the
  type system runtime in such cases as it doesn't compile and can't be used.
Remove unnecessary warning 520 for %shared_ptr when the base class is ignored.
2015-10-01 22:36:01 +01:00
William S Fulton
e12277a469 Ruby shared_ptr fixes for use with minherit 2015-10-01 22:36:01 +01:00
William S Fulton
14e1c47288 Fix Ruby smartptr feature for classes in a namespace 2015-09-25 22:58:00 +01:00
William S Fulton
c482637167 Add Ruby shared_ptr support 2015-09-25 22:57:59 +01:00
William S Fulton
faeaacf112 smartptr feature support - factor out common code 2015-09-25 22:57:59 +01:00
William S Fulton
4d4c7eca9a Ruby free function declaration change
Declare function taking void * parameter to be more flexible for upcoming
smart pointer support.
2015-09-14 07:19:57 +01:00
William S Fulton
0ee304188c Merge branch 'lyze-cffi-export-package'
* lyze-cffi-export-package:
  Add user documentation to the export package extension.
  Extend the export feature in the CFFI module to support exporting to a particular package.
2015-09-09 22:32:43 +01:00
Olly Betts
8a6874e633 Fix docstrings for callback functions with -builtin 2015-09-04 15:29:06 +12:00
Olly Betts
8ab622c6d0 [Python] Fix docstrings for %callback functions
Reinstates autodoc for callback function testcase from #467, actually
tests the resulting docstring in the _runme.py and fixes SWIG/Python
so the expected result is obtained.
2015-09-04 13:04:37 +12:00
Olly Betts
efcaa8fdac Drop code to handle compilers lacking the 'bool' type.
SWIG requires an ISO C++ compiler, so this is no longer useful.  Fixes
issue#513.
2015-09-02 09:40:55 +12:00
William S Fulton
567d4690cf Fix ruby warning using clang in director exception code
Suppresses warning:
  error: control may reach end of non-void function [-Werror,-Wreturn-type]
The UNUSED macro is not expanded in ruby.h for rb_exc_raise for clang when
it ought to be.
For patch #512
2015-08-31 14:05:31 +01:00
Sjoerd Job Postmus
5be177e5c3 Do not use bare exception in generated Python code.
By using the 'except:', you can catch all kinds of exceptions, including
the KeyboardInterrupt and SystemExit exceptions. From the generated
code, it is quite obvious that it is not these cases that should be
caught, but more specific ones like AttributeError and TypeError. To be
on the safe side, I decided to keep using 'Exception' for now.
2015-08-28 17:43:28 +02:00
Joseph C Wang
834a93f449 Revert "Merge pull request #494 from richardbeare/enumR2015B"
This reverts commit cb8973f313, reversing
changes made to ac3284f78c.
2015-08-11 09:57:57 +08:00
David Xu
8275f8158a Implement argout, freearg, and check typemaps for CFFI. 2015-08-10 21:47:12 -04:00
joequant
cb8973f313 Merge pull request #494 from richardbeare/enumR2015B
replacement for enumR2015 - tidied and rebased
2015-08-10 13:37:27 +08:00
Richard Beare
da1c6c60d3 This is a modification to support use of tricky enumerations in R. It
includes the addition of a _runme for an existing test - preproc_constants
that was previously not run. That tests includes a preprocessor based
setting of an enumeration which is ignored by the existing r enumeration
infrastructure. The new version correctly reports the enumeration value
as 4 - previous versions set it to 0. Traditional enumerations are unchanged.

The approach used to deal with these enumerations is similar to that of
other languages, and requires a call to a C function at runtime to return
the enumeration value. The previous approach figured out the values statically
and this is still used where possible. The need for a runtime call leads to
changes in when swig code is used in packages - see below.

One test that previously passed now fails - namely the R sourcing of
preproc_constants.R, as the enumeration code requires the shared library,
which isn't loaded by that script.

There is also a modification to the way the R _runme.R files are used.
The call to R CMD BATCH now includes a --args option that indicates
the source folder for the unittest.R file, and the first couple
of lines of the _runme.R files deal with correctly locating this.
Out of source tests now run correctly.

This work was motivated by problems generating the SimpleITK binding,
specifically with some of the more complex enumerations.

This approach does have some issues wrt to code in packages, but I can't
see an alternative. The problem with packages is that the R code setting
up the enumeration structures requires the shared library so that the C
functions returning enumeration values can be called. The enumeration
setup code thus needs to be moved to the package initialisation section.
For SimpleITK I do this using an R script, which I think is an acceptable
solution. The core part of the process is the following function. I dump
all the enumeration stuff into a .onload function. This is only necessary
if some of the enumerations are tricky.

splitSwigFile <- function(filename, onloadfile, mainfile)
{
p1 <- parse(file=filename)

getdefineEnum <- function(X)
{
return (is.call(X) & (X[[1]]=="defineEnumeration"))
}

dd <- sapply(p1, getdefineEnum)

enums <- p1[dd]
enums <- unlist(lapply(enums, deparse))

enums <- c(".onLoad <- function(libname, pkgname) {", enums, "}")

everythingelse <- p1[!dd]
everythingelse <- unlist(lapply(everythingelse, deparse))
writeLines(everythingelse, mainfile)
writeLines(enums, onloadfile)

}
2015-08-10 09:37:04 +10:00
xantares
92328a2016 pep257 & numpydoc conforming docstrings 2015-08-07 22:15:13 +01:00
David Xu
c1fad12bdb Extend the export feature in the CFFI module to support exporting to a particular package. 2015-08-05 21:58:50 -04:00
William S Fulton
c6f8aadc64 Cosmetic corrections - Mac OS X 2015-08-02 20:14:20 +01:00
William S Fulton
e69cc0c0f5 Improve python code indentation warning / error messages 2015-07-30 08:26:17 +01:00
William S Fulton
a779f9bbc1 Function comment header formatting corrections 2015-07-30 08:26:17 +01:00
William S Fulton
fa282b3540 Improve Python docstring indentation handling
SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring
feature.
SWIG-3.0.6 gave a 'Line indented less than expected' error instead of
truncating the docstring text.
Now the indentation for the 'docstring' feature is smarter and is
adjusted so that no truncation occurs.

Closes #475
2015-07-30 08:26:08 +01:00
xantares
812f789db6 Avoid gcc uninitialized variable warnings in Python wrappers.
Just initialize the local array with zeroes.

Closes #453.
2015-07-25 19:10:06 +02:00
William S Fulton
457e0bfa81 Typemap attribute fixes
Fix for breakages in previous few commits:
- Perl test-suite - the "varout" typemap "type" attribute is now
  expanded in typemap.c instead of Perl.cxx.
- The swig_typemap_warn errors testcase showed that $1 was no longer
  being expanded correctly when used in output typemaps (lname not set).
2015-07-24 00:32:46 +01:00
William S Fulton
a00ab42f80 Merge branch 'm7thon-issue-445-python-class-docstrings'
* m7thon-issue-445-python-class-docstrings:
  Add changes note for Python tp_doc slot and docstring
  Set class docstring in tp_doc slot for python -builtin

Conflicts:
	CHANGES.current
2015-07-18 00:14:37 +01:00
Anbiru Shouta
977240b3f4 Clearer variable name in Java director generated code
Closes #463
2015-07-17 22:34:08 +01:00
Michael Thon
7ed63b11d7 Set class docstring in tp_doc slot for python -builtin 2015-07-09 02:05:33 +02:00
William S Fulton
3718b810c7 Don't generate constructor wrappers if a base class has a private constructor
g++-5 errors out with this now with errors such as:

default_constructor_wrap.cxx:665:27: error: use of deleted function ‘FFF::FFF()’
   result = (FFF *)new FFF();
                           ^
default_constructor_wrap.cxx:314:7: note: ‘FFF::FFF()’ is implicitly deleted because the default definition would be ill-formed:
 class FFF : public F {
       ^
default_constructor_wrap.cxx:301:4: error: ‘F::~F()’ is private
    ~F() { }
    ^
default_constructor_wrap.cxx:314:7: error: within this context
2015-07-07 20:15:55 +01:00
William S Fulton
edcdaaec16 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
Nils Gladitz
925cec3a82 Add a space between literal and string macro
In C++11 a space between a literal and string macro is required.
2015-07-03 20:59:23 +01:00
Olly Betts
822b2355c0 Improve handling of whitespace in %pythoncode
Previously SWIG looked at the indentation of the first line and removed
that many characters from each subsequent line, regardless of what those
characters were.  This was made worse because SWIG's preprocessor removes
any whitespace before a '#'.  Fixes github issue #379, reported by Joe
Orton.
2015-06-29 22:12:38 +12:00
Simon Marchetto
b05f0057ca improve support of varargs 2015-06-23 16:24:35 +02:00
Ian Lance Taylor
11d8403c3c [Go] Fix member variables in base classes to handle CWRAP_NATURAL_VAR
correctly.  Add a test case for the problem.

Fixes #339.
2015-06-20 17:42:44 -07:00
William S Fulton
53b7659ebf Fix Python pep8 warning when using -fastinit (or -O)
Fixes: E231 missing whitespace after ','
2015-06-16 08:11:29 +01:00
William S Fulton
180e21269d Fix python -builtin -O and overloaded functions
More specifically fixes compile errors using -builtin -fastunpack -modernargs.
Recent regression (416277b). Closes #436.
2015-06-16 07:59:22 +01:00