Commit graph

4,806 commits

Author SHA1 Message Date
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
17d0610d00 [OCaml] Fix possible memory leaks in generated dispatch functions
All paths now free argv.
2019-02-23 04:05:03 -07:00
William S Fulton
1f46d9b7b9 Fix regression parsing gcc preprocessor linemarkers
These are preprocessor statement in the form:

 # linenum filename flags

Closes #1475
2019-02-19 21:32:04 +00:00
William S Fulton
b9350614b5 Fix typemap matching to expand template parameters when the name contains template parameters.
In the %typemap below the type is T and the name is X<T>::make
which now expands correctly to X< int >::make

template<typename T> struct X {
  %typemap(out) T X<T>::make "..."
  T make();
};

%template(Xint) X<int>;
2019-02-17 21:38:48 +00:00
William S Fulton
024eaeaacf Improve debug display of parameters
Debug display now displays parameters as strings for "kwargs", "pattern",
"templateparms", "throw" elements in the parse tree (not just "parms"
and "wrap:parms").
Add in single quotes when displaying these parameter lists as strings.
2019-02-17 20:03:23 +00:00
William S Fulton
629c881de5 Template instantion fixes when template parameter is used twice in type
For example T in:
Y<T>::YYY<T>::value_type
2019-02-17 20:03:18 +00:00
William S Fulton
de861bea64 Memory leak fixes calling Swig_scopename_split 2019-02-16 13:06:43 +00:00
William S Fulton
eb7b989c61 Fix parser error containing multiple #define statements inside an enum.
The second #define fails to parse:

  enum FooEnum {
    ENUM1 = 0,
    ENUM2 = 1,

  #define MACRO_DEF1 "Hello"
  #define MACRO_DEF2 "World!"

    ENUM3 = 2,
    ENUM4 = 3,
  };

Bug mentioned at https://sourceforge.net/p/swig/patches/333/
2019-02-16 08:09:56 +00:00
William S Fulton
6522afe90a
Merge pull request #1471 from ZackerySpytz/OCaml-segfaults-list-args
[OCaml] Fix segfaults when too few arguments are passed to a function
2019-02-15 19:14:45 +00: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
Zackery Spytz
cf83adfcd1 Add support for C++17 hexadecimal floating literals 2019-02-13 15:16:40 -07:00
Olly Betts
950473d77e [php] Whitespace improvements in generated C/C++ code 2019-02-12 10:14:25 +13:00
William S Fulton
be84fc62a9 Merge branch 'ZackerySpytz-cpp14-binary-integer-literals'
* ZackerySpytz-cpp14-binary-integer-literals:
  Add support for C++14 binary integer literals
2019-02-11 18:36:47 +00:00
William S Fulton
ad7f9cd8d7 Mark and setup OCaml as an experimental target language.
Issue #1437
2019-02-11 18:30:35 +00:00
Vadim Zeitlin
ddf4bbe112 Merge branch 'fix-ignore-param'
Fix for wrongly renaming parameters to "$ignore" in Python.

See https://github.com/swig/swig/pull/1462
2019-02-11 14:24:46 +01: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
Zackery Spytz
23d83cd9c1 Add support for C++14 binary integer literals
Closes #1030.
2019-02-10 15:38:49 -07: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
80b79fc583 Merge branch 'ZackerySpytz-cpp11_u_U_char_encoding_prefixes'
* ZackerySpytz-cpp11_u_U_char_encoding_prefixes:
  Document C++11 UCS-2 UCS-4 and C++17 UTF8 character literals support
  c++17 u8 character literals testcase
  C++17 u8 character literals fix
  C++17 u8 character literals testcase
  Fix the Java tests
  Add support for the C++11 u and U encoding prefixes for char literals
2019-02-10 17:39:03 +00:00
Zackery Spytz
8bf40596b8 C++17 u8 character literals fix 2019-02-10 16:06:53 +00:00
Vadim Zeitlin
2517f5b05e Don't apply %ignore to parameters
Fix regression introduced by 3f5c17824c
which resulted in using "$ignore" instead of the real parameter name in
Python if an %ignore/%rename($ignore) for the parameter name was used
(as could happen not necessarily intentionally when using wild card
ignores with regex matches) by explicitly checking if we're dealing with
a parameter node in apply_rename(), used by Swig_name_make(), and not
renaming it to "$ignore" in this case.

Extend the test suite to check for this case.

Closes #1460.
2019-02-10 13:40:12 +01: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
ed45d2835f Merge branch 'swig-fortran-fix-anonymous-apply-template'
* swig-fortran-fix-anonymous-apply-template:
  Fix failure of %apply directive in anonymous templates
  Add test showing typemap failure
2019-02-10 00:41:58 +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
Seth R Johnson
373a21aa3f Fix failure of %apply directive in anonymous templates 2019-02-06 08:48:40 -05:00
Zackery Spytz
8c2cb4e604 Add support for the C++11 u and U encoding prefixes for char literals
"u" and "U" are new in C11 and C++11 for char literals.
2019-02-05 15:08:35 -07: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
William S Fulton
df86ec5af6 Consistent use of target language version of options
If a version number is supported by the target language prefer to show it in the -help.
For example, -perl5 instead of -perl.
2019-02-05 19:18:46 +00:00
William S Fulton
29d30bd319 Consistent implementation for disabled languages
The deprecated php4 and php5 use the new Disabled language handling
recently implemented for a consistent implementation
2019-02-05 19:04:59 +00:00
William S Fulton
264b39fd00 Disable CFFI Common Lisp target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:42:23 +00:00
William S Fulton
6d7e3df54e Disable Allegrcol target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:42:16 +00:00
William S Fulton
09e0577d95 Disable Chicken target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:42:12 +00:00
William S Fulton
cb4bd26422 Disable Common Lisp / CLISP target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:42:07 +00:00
William S Fulton
df51dc8e8f Disable Common Lisp / S-Exp target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:42:00 +00:00
William S Fulton
f63d0db21b Disable Common Lisp / UFFI target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:41:54 +00:00
William S Fulton
8aa4086136 Disable Pike target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:41:46 +00:00
William S Fulton
ee3aeb8177 Disable Modula3 target language
Clean up to disable target languages that have been neglected/not functional.
Target language be fully deleted in SWIG 4.1 unless a new maintainer brings
it up to an acceptable status (experimental or supported).

Issue #1447
2019-02-05 18:41:34 +00:00
William S Fulton
849512f565 Add missing command line options to documentation
Options were taken from the output of running swig -help.
2019-02-04 18:46:50 +00:00