Commit graph

3,103 commits

Author SHA1 Message Date
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
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
William S Fulton
3759fcf999 Merge branch 'builtin-ctor-kwargs'
* builtin-ctor-kwargs:
  Python -builtin constructors silently ignored keyword arguments.
2020-01-13 19:29:47 +00:00
William S Fulton
67e8334ac8 Python -builtin constructors silently ignored keyword arguments.
Instead of silenty ignoring them, now a "TypeError: f() takes no keyword arguments"
exception is thrown if keyword arguments are used. Hence constructors and normal
methods/functions behave in the same way.

Closes issue #1595
2020-01-13 19:26:22 +00:00
William S Fulton
489629fd53 Python 3.8 builtin tp_print initializer
Add missing initializer for tp_print added in python-3.8
when using -builtin

Issue #1670
2020-01-05 22:40:41 +00:00
William S Fulton
b7dec23121 Merge branch 'python38'
* python38:
  Adding tp_vectorcall field to PyTypeObject for Python version 3.8
2020-01-05 22:01:51 +00:00
Alexander Shadchin
eaa16914d1 Adding tp_vectorcall field to PyTypeObject for Python version 3.8 2020-01-05 03:32:10 +03:00
Thomas Reitmayr
f5908eca76 Improve description of cast macros for Ruby
The macros for casting function pointers are now fully described and also
clarify why the macros act transparently for C even before Ruby 2.7.

In addition, an "if (CPlusPlus)" was removed in the code generator for
global variables in order to keep the distinction between C and C++ in
one place, which is at the definition of said macros.
2020-01-04 18:37:35 +01:00
Thomas Reitmayr
5542cc228a Move new macros for Ruby to their dedicated namespace 2020-01-03 21:45:53 +01:00
Thomas Reitmayr
00e291b319 Add support for Ruby 2.7
This commit fixes the signatures of various callback methods
and cleans up the macro definitions used for casting callbacks.

Note that the transparent version of the macro RUBY_METHOD_FUNC
is currently masked behind RUBY_DEVEL, see commit
1d91feaf13
In order to still support strict signature checking and prevent
nasty deprecation warnings, the use of RUBY_METHOD_FUNC had to
be replaced with VALUEFUNC.
2019-12-31 17:53:53 +01:00
William S Fulton
d53a54b4f7
Merge pull request #1668 from treitmayr/master
Fix code generated for Ruby global variables
2019-12-30 23:49:04 +00:00
Zackery Spytz
02862fb278 [OCaml] Fix compilation errors with OCaml 4.09.0
caml_named_value() was modified to return a const value* in OCaml
4.09.0.

Closes #1686.
2019-12-29 22:41:43 -07:00
William S Fulton
18b2dcd222 C# 'out' or 'ref' removal improvements in director typemaps.
- Add support to DOH Replace for not replacing inside C comments
- Fix removing 'out' or 'ref' when these are present in C comments
  in cstype typemaps.

Closes #1628
2019-11-26 19:39:28 +00:00
William S Fulton
6fb345feb2 'out' or 'ref' usage in a cstype typemap in directors
'out' / 'ref' was not always stripped out in parts of the
director code generation.

Issue #1628
2019-11-26 19:32:34 +00:00
William S Fulton
cb5d7398b5 Fix bug in Python builtin support for keyword args
The fix is when using kwargs feature or -keyword.
The fix is in the argument error checking when wrapping zero
argument constructors only. Supplied keyword args were silently
ignored.

Issue #1595
2019-11-01 19:46:42 +00:00
Thomas Reitmayr
18a3ef3911 Fix code generated for Ruby global variables
This commit fixes swig#1653 by creating a Ruby virtual variable
for a C/c++ global variable when SWIG is invoked with the
-globalmodule option.
2019-10-27 21:41:03 +01:00
Richard Beare
aca44d9d3a Removed some remaining commented sections 2019-08-30 21:23:07 +10:00
William S Fulton
6925ec796b Merge branch 'contrib/TekuConcept'
* contrib/TekuConcept:
  Dev Checkpoint 201908200213
  Dev Checkpoint 201906261312
  Dev Checkpoint 201906252227
  Dev Checkpoint 201906252221
  Dev Checkpoint 201906252210
  Dev Checkpoint 201906252113
  Add JS Native Directive Testcase
  JS Example Campatibility Update
  Add Native Directive Example
  Update JavaScript Documentation
  Add JS Native Wrapper API
2019-08-20 18:53:02 +01:00
Chris Walker
025269f121 Dev Checkpoint 201908200213 2019-08-20 02:13:50 -06:00
William S Fulton
fb776e1900 Merge branch 'cshar-fix-enum-constants'
* cshar-fix-enum-constants:
  Fix invalid code generated for "%constant enum EnumType ..." and add a test.
2019-08-08 07:44:21 +01:00
Rokas Kupstys
06345e2aa5 Fix invalid code generated for "%constant enum EnumType ..." and add a test. 2019-08-01 08:55:07 +03:00
William S Fulton
2cf075558c Replace all exit() with SWIG_exit()
For consistent cleanup on error
2019-07-31 00:08:49 +01:00
William S Fulton
b36ae64185 Remove all generated files on error.
Previously generated files were not removed,
potentially breaking Makefiles using file dependencies, especially when
-Werror (warnings as errors) was used.
2019-07-31 00:08:49 +01:00
William S Fulton
f69da524f0 Exit code change when using -Werror
Exit code is now sum of all errors, not just warnings as errors.
I'm can't think why the exit code wasn't like this in the first
place.
2019-07-31 00:08:49 +01: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