Commit graph

3,195 commits

Author SHA1 Message Date
Vadim Zeitlin
61e13eb42b Get rid of useless IS_SET_TO_ONE macro
Just use the standard GetFlag() instead.
2019-08-04 14:59:48 +02:00
Vadim Zeitlin
d1f8d46528 Fix some very wrongly indented lines and "else" style
Consistently put "else" on the same line as closing "}" from the
matching "if", if any.

No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
92c922c841 Remove trailing whitespace
No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
0599b77377 Remove useless overridden extendDirective()
There is no need to override it just to call the base class version.

Also remove the outdated comment, as %extend is supported currently
(albeit with some bugs remaining).

No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
7bef0b704d Remove unnecessary "virtual" keywords
Don't mark functions not intended to be overridden (nor overriding those
in the base class) as "virtual", this is useless and confusing.

No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
83e9d50763 Remove unused C::int_string field
This was simply never used at all.
2019-08-04 14:43:02 +02:00
Vadim Zeitlin
290f49a2c1 Remove unused C::tl_namespace member
This was never set to anything, so just drop it.
2019-08-04 14:41:29 +02:00
Vadim Zeitlin
d9b3453763 Add missing SWIGIMPORT to function declarations
This went unnoticed under Linux, but would have resulted in link errors
for all functions under MSW.
2019-08-04 14:33:34 +02:00
Vadim Zeitlin
b4d08c1787 Get rid of special ctor/dtor handling in C module
By delegating to the base class instead we not only save quite a few
lines of code, but gain support for ctors/dtors defined using %extend,
which didn't work before, allowing to reenable some of the previously
failing tests.
2019-08-04 02:22:16 +02:00
Vadim Zeitlin
bbac8ca521 Don't reimplement base class version of globalfunctionHandler()
This is useless and the C-specific version didn't handle template
methods added with %extend correctly, so removing this code also fixes
some (but not all yet) failures in extend_template_method.cpptest unit
test.
2019-08-03 14:40:09 +02:00
Vadim Zeitlin
b0d99a1cc3 Don't emit functions added by %extend into C structs
This is never going to work and just results in generating uncompilable
code.

In principle, we could either generate wrappers for these functions
while still handling the struct as a plain C struct, or switch to
generating class-like wrappers for it if it's %extended with any
functions, but for now just ignore them as this is the simplest thing to
do.

Incidentally, this makes the default_args_c test pass again now, after
the last merge with master pulled in such %extend directives into it.
2019-08-03 02:37:18 +02:00
Vadim Zeitlin
55741f9e31 Merge branch 'master' into C 2019-07-24 20:26:50 +02:00
Vadim Zeitlin
0ff6893b2d Make Python module source non-executable again
0f88f9997c (probably accidentally) changed
this file to be executable, undo this as it doesn't make sense for a
source file to have this mode.

See #1242.
2019-07-24 20:10:35 +02:00
William S Fulton
c8b1eed8ce Merge branch 'annotation_quoting'
* annotation_quoting:
  Examples: Unify string quoting in the Python sources
  Test-suite: Unify string quoting in the Python sources
  Tools: Unify string quoting in the Python sources
  Generator: Unify string quoting in generated Python sources
  Generator: Remove trailing whitespaces in the Python module
2019-07-18 07:23:06 +01:00
Dmitry D. Chernov
c20b6f5b0e Generator: Unify string quoting in generated Python sources 2019-07-14 11:08:17 +10:00
Dmitry D. Chernov
9f79fb5216 Generator: Remove trailing whitespaces in the Python module 2019-07-14 11:06:10 +10:00
William S Fulton
aea7a6d30f Merge branch 'patch-1'
* patch-1:
  nested_inheritance_interface testcase enhancement
  Add nested_inheritance_interface test for csharp
  Fix class name for nested classes
  Add nested_inheritance_interface test
  Fix class name for nested classes

Conflicts:
	CHANGES.current
2019-07-09 19:37:35 +01:00
Isaac Pascual Monells
63497c8d0e Fix class name for nested classes 2019-07-08 12:49:00 +02:00
William S Fulton
b58995c89e $arg and $input were incorrectly substituted in the argout typemap
when two or more arguments were present.

Closes #1559
2019-06-28 08:09:47 +01:00
Isaac Pascual Monells
22c27cf216
Fix class name for nested classes
The feature %interface_impl from swiginterface.i differ on generated function
name from JNI wrapper class when using nested classes without flatnested.
2019-06-27 15:39:37 +02:00
William S Fulton
4301fa548d Remove some legacy cruft from Python proxy class
These methods are no longer used:
_swig_getattr
_swig_setattr
_swig_setattr_nondynamic
2019-06-27 07:40:49 +01:00
luz.paz
87695dacb1 Misc. documentation and source comment typo fixes
Found via `codespell -q 3 -L uint,od,objext,ba,cmo,bae,ans,struc,fo,clos,goin,upto,thru`
Revert changes in previous commit
2019-05-28 11:41:22 +12:00
Frederik Schubert
b3a3c4f09e Don't add a closing php-tag
This PR removes the closing `?>` PHP tag from generated files. [PSR-2](https://www.php-fig.org/psr/psr-2/) states:

> The closing `?>` tag MUST be omitted from files containing only PHP.

A problem might occur if files with any character after the closing tag are used with `include` or `require`. It might trigger an output and disallow HTTP header manipulation. See the popular [_headers already sent_](https://stackoverflow.com/a/8028987/1847340) debate on SO.
2019-05-22 11:35:08 +12:00
Zackery Spytz
2f48bec666 Merge remote-tracking branch 'upstream/master' into OCaml-INPUT-OUTPUT-INOUT-primitives 2019-05-08 14:05:02 -06:00
William S Fulton
11b54b0cbd Fix command line error handling to work like in 3.0.12
Output is once again:

  $ swig -versioon
  Unable to find option or file '-versioon', Use 'swig -help' for more information.

instead of

  $ swig -versioon
  No target language specified
2019-04-25 23:13:51 +01:00
Ian Lance Taylor
8a1c09e280 Fix Go tests to run in module mode
Stop using relative imports and add a go.mod file.

Tested against Go 1.6 through Go pre-1.13, and gccgo.
2019-04-24 21:43:38 -07:00
Ian Lance Taylor
77f075b6e8 When generating Go code, make -cgo the default.
Add new -no-cgo option to disable the default.
Keep -cgo as a no-op for existing users.
2019-04-19 12:49:56 -07:00
William S Fulton
65a7fafd84 Fix minor whitespace regression in Java generated code 2019-04-18 20:27:14 +01:00
William S Fulton
831fae3c69 Add the parameters typemap attribute to D and Java destructor wrapper typemaps
Added to the javadestruct, javadestruct_derived, ddispose, ddispose_derived
typemaps to mirror enhanced flexibility in the csdisposing and
csdisposing_derived (C#) typemaps. If provided the contents are generated
as the delete/dispose method's parameters declaration.
2019-04-08 19:20:50 +01:00
William S Fulton
06462acdf9 Fix C# CA1063 warning by implementing the recommended Dispose methods.
Previously just the Dispose() method was generated.
Now the Dispose() and Dispose(bool disposing) methods are generated.
Changes are required if custom "csfinalize", "csdestruct" or "csdestruct_derived"
typemaps are being used. Details in #421 on Github. SWIG will error out if one of
the "csfinalize, "csdestruct" or "csdestruct_derived" typemaps are found. Example
error message:

  foo.h:60: Error: A deprecated csfinalize typemap was found for Foo, please remove
  it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the
  csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.

Closes #421
2019-04-08 19:20:45 +01:00
William S Fulton
39599f2112 Always use fastunpack for Python swigconstant wrappers 2019-03-21 21:17:21 +00:00
William S Fulton
9f0b9da024 Always use fastunpack for Python swigregister function 2019-03-21 20:59:54 +00:00
William S Fulton
826f1448b8 Fix Python low-level static member setters.
The low-level API for setting static member variables stopped working
when the fastunpack option was turned on by default. The PyMethodDef
setup requires METH_O, not METH_VARARGS with fastunpack.
2019-03-20 21:44:34 +00:00
William S Fulton
cfa7a4d4d0 Merge branch 'REnums2018'
* REnums2018:
  Fix R return by C++11 const ref enum classes
  Remove unused code in r.cxx
  extra doc on anonymous enums
  ENH:
  FIX: references to enums now functioning
  DOC: Extended documentation on enumeration support in R
  FIX: Corrected path to output from R tests
  Reformat comments in R module
  ENH: Run test for enum_thorough in R
  Code style changes post review
  ENH: R Module: Enumerations with values set by calls to C code, allowing arbitarily complex value expressions.
  Setting enum values with calls to the C code.
2019-03-18 18:03:20 +00:00
William S Fulton
f5b53683f0 Remove unused code in r.cxx 2019-03-18 17:40:52 +00:00
Richard Beare
6e3518c9b4 ENH:
Replaced the old getRClassName with the new one that uses the swig
functions for detecting, adding and removing pointers andreferences.
2019-03-11 21:17:03 +11:00
Richard Beare
43af20ab3b FIX: references to enums now functioning
There is some consolidation work to be done. The
core of the change is getRClassName2, which will
probably eventually replace getRClassName.

getRClassName seems to be in a funny state, with
a middle argument that is commented out and never
used.

My next step is to verify whether the new version
can replace it.
2019-03-08 21:56:36 +11:00
Richard Beare
80cd2f5cd7 Reformat comments in R module 2019-03-08 21:56:36 +11:00
Richard Beare
b5af07fd95 Code style changes post review 2019-03-08 21:56:36 +11:00
Richard Beare
06de704938 ENH: R Module: Enumerations with values set by calls to C code, allowing
arbitarily complex value expressions.

R-side initialization of the enumeration structure employs
delayedAssign, which allows the initialization code to be
sourced before loading the shared library, which is the
usual behaviour for code in an R package.
2019-03-08 21:56:36 +11:00
Richard Beare
e9b39797cc Setting enum values with calls to the C code. 2019-03-08 21:56:36 +11:00
Zackery Spytz
a0b84f5180 Fix some MSVC compiler warnings in the test suite
nested_in_template_wrap.cxx(247): warning C4244: 'initializing': conversion from 'double' to 'int', possible loss of data
python_pybuffer_wrap.cxx(2788): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
Modules\python.cxx(2227) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
2019-03-07 09:44:01 -07:00
William S Fulton
bc0645ce2b Merge branch 'ZackerySpytz-director-classes-final-methods'
* ZackerySpytz-director-classes-final-methods:
  Warning tweaks for destructors that are final in director classes
  Documentation for directors and virtual final methods
  Fixes for final destructors in director classes
  Warning fix for final destructor in directors
  Remove a useless warning filter
  Fix the handling of director classes with final methods
2019-03-03 15:12:53 +00:00
William S Fulton
39b44a377a Warning tweaks for destructors that are final in director classes 2019-03-03 15:12:29 +00:00
William S Fulton
3b07cba740 Fixes for final destructors in director classes
A class marked as a director with a final destructor should not be a
wrapped as a director class. Fix seg faults in this case.
2019-03-03 14:52:52 +00:00
William S Fulton
b9c4a84780 Warning fix for final destructor in directors
Fix suppression of final destructors used in director classes.
Add testcase for final destructors in director classes.
2019-03-02 19:02:35 +00:00
William S Fulton
83ea2280e2 Fix Python compile errors with overloading and varargs
Fixes wrapping overloaded functions/constructors where a vararg
function is declared after a non-vararg function.
This is a long standing bug in the Python layer exposed since fastunpack
was turned on by default.
2019-02-25 19:27:23 +00:00
Zackery Spytz
cbae09f92f Merge remote-tracking branch 'upstream/master' into director-classes-final-methods 2019-02-24 08:08:52 -07:00
Zackery Spytz
17d0610d00 [OCaml] Fix possible memory leaks in generated dispatch functions
All paths now free argv.
2019-02-23 04:05:03 -07:00
Zackery Spytz
c3d652c785 Fix the handling of director classes with final methods
Generated SwigDirector_* classes were attempting to override
methods marked as final.

In addition, give a warning if the destructor of a director class is
final.

Closes #564.
2019-02-22 06:28:53 -07:00