Commit graph

3,126 commits

Author SHA1 Message Date
Olly Betts
9ddc9dceb7 Remove support for $source and $target
These were officially deprecated in 2001, and attempts to use them have
resulted in a warning (including a pointer to what to update them to)
for most if not all of that time.

Fixes #1984
2021-04-30 10:20:14 +12:00
William S Fulton
8a21922f1a bool performance warning fix 2021-04-26 22:32:52 +01:00
Olly Betts
f198ff0a43 Fix more "allows to" and other typos 2021-04-21 15:54:46 +12:00
Olly Betts
5ec65fde0a Initialise _v to 0 in typecheck case
This avoids using _v uninitialised if there's an empty typecheck
typemap, such as the dummy one we have for std::initializer_list.

Fixes GCC warning on cpp11_initializer_list testcase when compiled
with -O2.
2021-04-19 17:42:22 +12:00
Olly Betts
0bf846f56f Eliminate unused Printf args 2021-04-13 10:43:51 +12:00
Olly Betts
1757f548a4 Make -py3 generate a check for Python >= 3.0
Closes #1777
2021-04-12 15:07:00 +12:00
Olly Betts
18bc3e287b php: Avoid double underscore in generated code
These are reserved by the C++ standard, but we were generating them
in the le_swig__... names.
2021-04-02 08:07:44 +13:00
Olly Betts
2392f6146a Remove variables which are set but never used 2021-03-31 04:39:18 +13:00
Olly Betts
b840911410 Remove outdated FIXME/TODO from php.cxx
See #1529
2021-03-26 11:18:07 +13:00
William S Fulton
90cdbee6a6 Python -builtin fix wrapping constructors with varargs
Fix compilation error when using -builtin and wrapping varargs in constructors

Closes #1942
2021-03-23 23:57:49 +00:00
Olly Betts
3584c7d49c Add initial support for PHP8
Testcase director_overload2 is failing, but the rest of the testsuite
passes.
2021-03-19 19:30:27 +13:00
Olly Betts
2e7da86b2c php: Fix overloaded directed methods with non-void return
We were treating  such methods like constructors and assigning to the
internal _cPtr, which just seems bizarrely wrong.

Fixes #1900
2021-03-18 10:58:44 +13:00
Michel Zou
ee8d47cec4 Fix few unused variable warnings 2021-03-07 11:20:31 +00:00
William S Fulton
fe676f840a Merge branch 'director-return-const-pointer'
* director-return-const-pointer:
  Put test in alphabetical order
  Perform proper spacing in director method declarations
2020-10-07 22:26:25 +01:00
William S Fulton
8889635683
Merge pull request #1859 from adelva1984/no-host-exceptions
javascript: replace exceptions with SWIG_exit
2020-10-07 22:09:01 +01:00
William S Fulton
e71f781140
Apply suggestions from code review
Print errors to stderr instead of stdout
2020-10-07 22:06:47 +01:00
William S Fulton
c1b004f4fa Add access modifier support for interface feature
Add ability to change the modifiers for the C# and Java
interface generated when using the %interface macros.

For C# use the 'csinterfacemodifiers' typemap.
For Java use the 'javainterfacemodifiers' typemap.

For example:

  %typemap(csinterfacemodifiers) X "internal interface"

Closes #1874
2020-09-25 18:54:25 +01:00
William S Fulton
b018c32f9d Fix crashes in swig_connect_director during director class construction.
Occurs when using the director class from multiple threads - a race condition
initialising block scope static variables.

Block scope static variables are guaranteed to be thread safe in C++11,
so the fix is guaranteed when using C++11. However, most modern compilers
also fix it when using C++03/C++98.

Closes #1862
2020-08-28 18:23:47 +01:00
William S Fulton
e774fe5cfd Python 3.9 support for -builtin
Add missing initializer for member ‘_heaptypeobject::ht_module’ to complete
Python 3.9 support.
2020-08-27 20:22:39 +01:00
Alistair Delva
4d844a8dc2 javascript: replace exceptions with SWIG_exit
When building SWIG for Android, there is no support for C++ exceptions.

In the cases there is "Illegal state", it seems more like an internal
error, so we can replace the throw calls with a debug print and exit
immediately.

Closes #1858
2020-08-13 07:55:35 -07:00
Thomas Reitmayr
c259702314 Perform proper spacing in director method declarations
If a director method returns a const pointer, eg. 'int *const', then in its
method declaration a space has to be inserted between 'const' and the
method name.
This fixes swig#1810.
2020-06-20 12:14:42 +02:00
William S Fulton
ee7eb6b58a Merge branch 'directors-comparison-operators'
* directors-comparison-operators:
  Use %rename
  Fix wrapping of virtual comparison operators with directors
2020-06-14 22:23:57 +01:00
William S Fulton
991c2afe11 Merge branch 'python-doxygen-quotes'
* python-doxygen-quotes:
  Fix generated Python code for Doxygen comments with triple quotes
  Fix generated Python code for Doxygen comments ending with quote
2020-06-07 10:23:33 +01:00
Zackery Spytz
4e57c5536d Fix wrapping of virtual comparison operators with directors
Closes #1642.
2020-06-05 10:25:20 -06:00
Noah Stegmaier
cf7802c5cc escape phony targets as well 2020-06-04 12:24:08 +02:00
Noah Stegmaier
e224194735 escape target name 2020-06-04 12:17:51 +02:00
Noah Stegmaier
d723f82160 escape path of generated file 2020-06-04 12:10:24 +02:00
Noah Stegmaier
3cc4d76e23 escape filepaths 2020-06-04 12:10:24 +02:00
William S Fulton
85f2378b84 Merge branch 'r-script-fixes'
* r-script-fixes:
  Fix further missing semicolons in R code.
  fixed some missing semicolons. Each one caused a compile error in generated code
2020-06-02 18:11:12 +01:00
William S Fulton
6542d848dc Fix further missing semicolons in R code.
Fixes errors in R code when using -small as this option causes lines to be joined.
2020-06-02 10:16:18 +01:00
Karl Wette
d9c94848ec octave.cxx: fix exception raising for newer Octave versions
- Since (at least) Octave 5.1.0, the Octave error() function now raises a C++
  exception, which if uncaught immediately exits a SWIG wrapper function,
  bypassing any cleanup code that may appear after a "fail:" label.
- This patch adds a "try { ... } catch(...) { }" block around the contents of
  SWIG wrapper functions to first execute the cleanup code before rethrowing any
  exception raised.
- It is backward compatible with earlier versions of Octave where error() does
  not raise an exception, which will still branch to the "fail:" block to
  execute cleanup code if an error is encountered.
2020-05-31 06:43:15 +10:00
Karl Wette
e67f125582 octave.cxx: add missing return statement before "fail:" label 2020-05-31 06:43:15 +10:00
Karl Wette
f6286a1b19 octave.cxx: this belongs in the code (as opposed to definition) section 2020-05-31 06:43:15 +10:00
Karl Wette
99bb5dcc70 octave.cxx: remote whitespaces 2020-05-31 06:43:15 +10:00
Karl Wette
66f4f7de8e octave.cxx: replace Printf() with Append() for consistency 2020-05-31 06:43:15 +10:00
khoran
d58041606e fixed some missing semicolons. Each one caused a compile error in generated code 2020-03-25 11:01:12 -07:00
Vadim Zeitlin
f57b096c92 Fix generated Python code for Doxygen comments with triple quotes
In addition to the changes in the previous commit, also avoid syntax
errors in the generated Python docstrings by splitting them into several
parts if there are 3 quotes in a row in the input, as it's impossible to
have them inside triple-quoted strings, generally speaking (i.e. if
there are occurrences of both """ and ''' inside the string).
2020-03-04 00:57:31 +01:00
Vadim Zeitlin
b81cd1bdab Fix generated Python code for Doxygen comments ending with quote
Single-line Doxygen comments ending with a double quote resulted in
syntactically-invalid Python docstrings in the output, so use triple
single quotes as delimiters in this case to avoid it.
2020-03-04 00:56:27 +01:00
Vadim Zeitlin
45fdcc2fec Fix reading options files on platforms with unsigned char
This fixes EOF detection on platforms where char is unsigned, as
comparing it with EOF could never return true there.

Thanks gcc for the warning "comparison is always true due to limited
range of data type [-Wtype-limits]".
2020-02-16 17:03:14 +01:00
William S Fulton
0c00daf3a1 Merge branch 'autodoc-doxygen-fix'
* autodoc-doxygen-fix:
  Fix crash in Python backend when using empty docstrings
2020-01-31 18:57:47 +00:00
Arnaud Barré
3fa5c8c652 Fix R memory leak on exception
There is a possible memory leak in case the SWIG_exception_fail macro
is called. The problem is related to its definition that call the
function Rf_warning. This function (as well as Rf_error) involves
a longjmp over C++ destructors on the stack. Thus, all the objects
allocated on the heap are not freed.

Closes #914
2020-01-30 20:43:39 +00:00
William S Fulton
b0ce22625b Remove redundant code from r.cxx 2020-01-30 19:04:32 +00:00
Vadim Zeitlin
e14532ce52 Fix crash in Python backend when using empty docstrings
Due to confusion in build_combined_docstring(), we could call
DohDelete() on the "feature:docstring" string, which resulted in a crash
when trying to use it later.

Fix this and simplify the code at the same time by ensuring that we
always use a copy of "feature:docstring" if it's not empty or don't use
it at all if it's empty -- like this we don't have to check for its
length each time before using it.

Closes #1648.
2020-01-30 16:11:18 +01:00
William S Fulton
88ef6e0931 Fix display of template classnames in generated R code 2020-01-30 08:34:07 +00:00
William S Fulton
7648542775 Merge branch 'RMemberListTrialSimplify2019'
* RMemberListTrialSimplify2019:
  ENH R abstract_access_runme
  ENH R accessor processing test
  Removed some remaining commented sections
  moved registration routine and use swig_name_get
  calling Swig_name_setget
  Used Swig_name_register so that Swig_name_wrapper produces the correct name without a separate replace call.
  Removed last instance of using Strcmp to check for a set/get method. Replaced with check for flag.
  Alternative version of using memberlist processing. This clarifies the logic within OutputMemberReferenceMethod by filtering the lists into classes, rather than doing it internally. Code isn't any shorter.
  commenting out unused code
  first pass at removing string comparisons for set/get methods
  trial changing member list processing
2020-01-30 07:29:45 +00:00
William S Fulton
b3da344765 Add some comments about shared_ptr upcast code 2020-01-24 19:46:39 +00:00
William S Fulton
564a91864a Refactor upcasts code
In preparation for possible improvement in usage of
SwigType_typedef_resolve_all - a SwigType* should be used,
not a readable name in a String*.
2020-01-23 19:30:03 +00:00
William S Fulton
0425a61fa8 shared_ptr upcast fixes for D
Same changes that were applied to Java/C# in ab7f526805
2020-01-23 18:03:22 +00:00
William S Fulton
6910e5f09c Merge branch 'shared-ptr-template-upcast'
* shared-ptr-template-upcast:
  comments
  Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup
  Adding test case demonstrating issue where SWIG does not generate a correctly typed, upcasted shared_ptr for a template instantiation deriving from a base class
  WIP - Use the non-encoded type string for upcasting a shared_ptr of a derived type to a shared_ptr of the base type
  comments
  Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup
  Adding test case demonstrating issue where SWIG does not generate a correctly typed, upcasted shared_ptr for a template instantiation deriving from a base class
  WIP - Use the non-encoded type string for upcasting a shared_ptr of a derived type to a shared_ptr of the base type
2020-01-17 18:45:30 +00:00
William S Fulton
5ce839932c Merge branch 'OCaml-caml_named_value-const'
* OCaml-caml_named_value-const:
  [OCaml] Fix compilation errors with OCaml 4.09.0
2020-01-13 19:46:29 +00:00