Commit graph

3,033 commits

Author SHA1 Message Date
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
Zackery Spytz
b74b2189e6 [OCaml] Rename ocaml.swg to ocamlrun.swg
Rename ocamldec.swg to ocamlrundec.swg.
2019-02-18 22:35:55 -07:00
Zackery Spytz
071803f000 [OCaml] Fix segfaults when too few arguments are passed to a function
Prevent segfaults when too few arguments are passed to a function.

Length checks are not needed for the wrappers of overloaded
functions -- the generated dispatch function already checks.

Add default_args_runme.ml.

Fix minor errors in some runtime tests.  Extra args were being passed
in some cases.
2019-02-15 01:17:15 -07:00
Olly Betts
950473d77e [php] Whitespace improvements in generated C/C++ code 2019-02-12 10:14:25 +13:00
William S Fulton
ad7f9cd8d7 Mark and setup OCaml as an experimental target language.
Issue #1437
2019-02-11 18:30:35 +00:00
William S Fulton
43438b66ab Re-organise some generate Python code for method creation and docstring support
Fix ‘PyMethodDef* SWIG_PythonGetProxyDoc(const char*)’ declared ‘static’ but
never defined [-Wunused-function]

Closes #1448
2019-02-10 22:55:16 +00:00
Olly Betts
ce5a249878 Drop -php4 option completely
SWIG's support for PHP4 was removed over a decade ago, and PHP4 itself
went out of security support more than a decade ago too - nobody is
realistically going to be trying to generate PHP4 bindings in 2019.
2019-02-11 10:49:20 +13:00
William S Fulton
c7ff070cd7 MzScheme - add missing return 2019-02-10 10:40:07 +00:00
William S Fulton
a8f927dd50 Merge branch 'mzscheme-experimental'
* mzscheme-experimental:
  Fix mzscheme name and unions testcases
  Terminology correction in html docs
  Suppress experimental language warning when running the test-suite
  Mark MzScheme as an experimental language
  Add mzscheme to Travis testing
  Format mzscheme help output
  Mzscheme out of source examples fixes
  Standardise Mzscheme simple example
  Standardise Guile simple example
  Fix mzscheme static variable wrappers
  MzScheme missing destructor added in, std_vector example fixed
  Fix mzscheme simple example
  Fix mzscheme multimap example
  Skip failing MzScheme tests
2019-02-10 00:50:35 +00:00
William S Fulton
9ab873f432 Merge branch 'ZackerySpytz-OCaml-classDirectorMethod-CAMLreturn'
* ZackerySpytz-OCaml-classDirectorMethod-CAMLreturn:
  [OCaml] Fix possible GC issues in generated director code

 Conflicts:
	Examples/test-suite/ocaml/director_unroll_runme.ml
2019-02-09 22:54:43 +00:00
William S Fulton
d7bb500315 Merge branch 'ZackerySpytz-OCaml-director-ctors'
* ZackerySpytz-OCaml-director-ctors:
  [OCaml] Fix a bug in the ctors of director classes
2019-02-09 22:28:10 +00:00
William S Fulton
d595a7a9ed Merge branch 'ZackerySpytz-OCaml-cache-caml_named_value'
* ZackerySpytz-OCaml-cache-caml_named_value:
  [OCaml] Cache the result of caml_named_value() in some cases
2019-02-09 22:14:10 +00:00
William S Fulton
5249dfefc5 Merge branch 'ZackerySpytz-OCaml-module-docstring'
* ZackerySpytz-OCaml-module-docstring:
  [OCaml] Add support for the docstring option in the module directive
2019-02-09 22:02:21 +00:00
William S Fulton
b4257fb1f2 Mark MzScheme as an experimental language 2019-02-09 17:58:06 +00:00
William S Fulton
a2db2a6e27 Format mzscheme help output
Also simplify -dynamic-load option help as it does more than
not emit scheme_initialize, scheme_reload, scheme_module_name.
2019-02-09 17:34:02 +00:00
William S Fulton
20344093ef Fix mzscheme static variable wrappers
$argnum needs to be expanded in the 'varin' typemap which shares
code used by the 'in' typemap.
Setting the static variable is also a function call (argnum=1).

Added class examples - needs static variables to work
Test newly working test cases with this fix
2019-02-09 14:44:33 +00:00
William S Fulton
b21a28f26a MzScheme missing destructor added in, std_vector example fixed 2019-02-09 14:44:33 +00:00
Olly Betts
123eabf200 [PHP] Wrap renamed constructor as static method
Previously it was wrapped as a non-static method, which results in
a diagnostic from PHP if called as a static method.
2019-02-09 12:51:45 +13:00
Olly Betts
3f9ebb31b9 [PHP] Don't generate code referencing undefined $r
This could happen in overloaded methods which returned void and took at
least one const std::string& parameter.
2019-02-08 18:09:52 +13:00
Zackery Spytz
28a846705f [OCaml] Fix possible GC issues in generated director code
Make `classDirectorMethod()` generate `CAMLreturn_type()` or
`CAMLreturn0` when there are local variables of type `value`.
2019-02-07 22:08:10 -07:00
Olly Betts
890617f5a5 Fix swig -help to exit with status 0
Fixes #1453
2019-02-08 17:18:30 +13:00
Zackery Spytz
828ce477c8 [OCaml] Fix a bug in the ctors of director classes
If a class was given the director feature, it was not possible
to use ctors with multiple parameters.

Add director_default_runme.ml (it is based on
director_default_runme.java).
2019-02-05 13:35:43 -07:00