Commit graph

22,554 commits

Author SHA1 Message Date
Seth R Johnson
d7e0aaa57d Enable 'regextarget' option for '%namewarn'
This enables auto-renaming of identifiers beginning with '_', necessary
for Fortran.
2022-02-06 13:51:37 -05:00
Olly Betts
d47970e2fd Fix problem with recent commit
I failed to fully remove the conditional from one example in
1a03840172.
2022-02-06 16:50:30 +13:00
Olly Betts
b06ab566cb -DFOO on the SWIG command line now sets FOO to 1
This is consistent with C/C++ compiler preprocessors.  Previously
SWIG set FOO to an empty value.

Fixes #2193
2022-02-06 10:18:49 +13:00
Olly Betts
9d7c962ee8 Clean up uses of Replace()
We were passing flags of DOH_REPLACE_ANY|DOH_REPLACE_FIRST in three
places, which doesn't make sense as those are mutually exclusive
concepts.  In the current implementation DOH_REPLACE_FIRST wins in
this situation, so replace with that and clarify the docs.
2022-02-06 09:59:30 +13:00
William S Fulton
3354423c15 changes file edits 2022-02-05 20:52:56 +00:00
William S Fulton
34d80dcb8b attribute library documentation edits 2022-02-05 20:52:50 +00:00
William S Fulton
aef4a0f90a Merge branch 'doc-work' into upstream-master
* doc-work:
  Move the attribute.i docs into Library.html
  Move %attribute documentation into the manual
2022-02-05 20:52:42 +00:00
Olly Betts
ad6c81817f Add CHANGES.current entry for #2194 2022-02-06 09:47:08 +13:00
Olly Betts
f85626207c
Merge pull request #2194 from swig-fortran/mark-noassign
Auto-detect non-assignable classes
2022-02-06 09:44:29 +13:00
Olly Betts
1a03840172 [octave] Simply checks on exist()
As suggested by kwwette in #1672, just check exist() is non-zero in
cases where the non-zero value returned varies depending on Octave
version.
2022-02-06 09:03:16 +13:00
Seth R Johnson
5b7edebdba Placate scilab character limit 2022-02-04 14:54:11 -05:00
Seth R Johnson
5a2656ab80 Don't mark as "noassign" when a variable is immutable
I had assumed member variables could only be noassign by being "const",
but I had forgotten about the `%immutable` keyword being applied via
SWIG.
2022-02-04 14:03:01 -05:00
Seth R Johnson
03dd2ec39d Auto-detect non-assignable classes
Classes with references or const data are now marked as 'noassign'.
This renders many explicit `private: operator=` declarations redundant.
2022-02-04 09:51:18 -05:00
Olly Betts
073d144b0e Add CHANGES.current entry for #1672 2022-02-04 16:38:30 +13:00
Olly Betts
a60655a86b Merge branch 'octave-4-4-bugfix' of https://github.com/friedrichatgc/swig
Fixes #1672
2022-02-04 16:36:05 +13:00
Olly Betts
bf8ee5fb70 Fix stale links to doxygen docs 2022-02-04 14:04:48 +13:00
Olly Betts
633bf60131 Make download links https:
The http: links just redirect to https: anyway, so let's better
protect our users by using https: from the start.
2022-02-04 14:04:48 +13:00
Olly Betts
951f946341 [Python] Improve handling of SWIG_Py*Method_New
The SWIG_PyInstanceMethod_New method is no longer added to wrapped
classes except when it's actually needed, which is when
(!builtin && fastproxy) is true (which it isn't by default).

The SWIG_PyStaticMethod_New method is no longer is now similarly
gated - previously only (fastproxy) was checked.

Finally the C/C++ functions that implement these were always compiled
into the module, but now they're only included if
(!builtin && fastproxy) is true.

Issue noted by vadz in #2190.
2022-02-04 12:58:56 +13:00
Olly Betts
07f3637f06 [PHP] Remove useless shadowed variable in example 2022-02-03 23:04:58 +13:00
Olly Betts
7a21da90fd [C#] Fix memory leak in directorin typemap for std::string.
Fixes #998
2022-02-03 22:50:28 +13:00
Olly Betts
7cb2f46e06 [Python] Sort out handling of self parameter
When not using -builtin, the self parameter is now still made
available so that user typemaps can use it.  Fixes #967.

When using -builtin, fix -Wunused-parameter warnings in the generated
wrapper code.  See #801.

Based on a commit peeled out of #801 by teythoon.
2022-02-03 18:31:18 +13:00
Olly Betts
b77c0d02bc CHANGES.current: Add entry for recent change 2022-02-03 18:25:09 +13:00
Olly Betts
bede0b407b [python] Workaround MSVC2022-related bug
Fixes #2090
2022-02-03 17:54:50 +13:00
Justus Winter
5691f3f685 Fix function prototypes of generated pointer functions
Previously, the emitted constructors were incomplete prototypes.  When
compiling the wrapper code using gcc 6 and -Wstrict-prototypes, the
following warnings were emitted:

  warning: function declaration isn’t a prototype [-Wstrict-prototypes]

See #801
2022-02-03 17:25:44 +13:00
Olly Betts
0cdbbf326b Fix -Wstrict-prototypes warning in generated PHP wrappers 2022-02-03 17:21:17 +13:00
Olly Betts
ebbf2e6077 Allow method calls in expressions
This allows default parameter values containing method calls to be
parsed and handled - e.g. `x->foo(3,4)` and `y.z()`.
Fixes #660 and https://sourceforge.net/p/swig/bugs/1081/
2022-02-03 17:20:30 +13:00
Olly Betts
20588a4dc7 Uncomment line in testcase which now works
03ef3ecb6e86aa78a64119f30e683ee474ddb56 added support for ID PERIOD ID
in an expression.
2022-02-03 17:20:30 +13:00
Olly Betts
11009f8e23 Document calling extend methods from C/C++
Note that it's necessary to use the naming scheme we already document
to do this.

Fixes https://sourceforge.net/p/swig/bugs/889/
2022-02-03 11:22:16 +13:00
Olly Betts
2e98189564 [Ruby] Fix remove of prefix from method name
The prefix is now only removed at the start.

Fixes https://sourceforge.net/p/swig/bugs/1136/
2022-02-02 15:53:23 +13:00
Olly Betts
27a3d16ac6 Allow object reference in C++ trailing return type
Fixes #231
2022-02-02 11:31:45 +13:00
Clement David
aee380ce82 [scilab] Name init function name to avoid collision
Use SWIG_<module>_Init() function to init the module rather than
<module>_Init() as the latter can collide with a function being wrapped.

Fixes #745
Fixes #1739
2022-02-02 09:43:06 +13:00
Olly Betts
eb13261950 [Java] Note use of %ignore with %native
This is needed if you're wanting to effectively replace the generated
JNI wrapper for a C/C++ function.

Fixes https://sourceforge.net/p/swig/bugs/368/
2022-02-01 16:38:16 +13:00
Olly Betts
9d06d4ac45 [Tcl] Add changed file missed recent commit
This should have been in 6f4adde4b4
2022-02-01 16:00:12 +13:00
Olly Betts
3e019977c5
Merge pull request #1398 from swig-fortran/missing-includes
Add missing includes to library and test cases
2022-02-01 14:05:17 +13:00
Olly Betts
b66926b98d Add CHANGES entry for #2083 2022-02-01 13:34:17 +13:00
Olly Betts
9f74955e8d [Ocaml] Fix to work with CAML_SAFE_STRING
CAML_SAFE_STRING is on by default in current Ocaml versions, and was
stopping SWIG-generated wrappers from compiling.

Fixes #2083
2022-02-01 13:29:53 +13:00
Olly Betts
6f4adde4b4 [Tcl] Fix std_vector typecheck typemaps
In some cases the typecheck typemap would try to access the first
element of an empty Tcl list.

Fixes https://sourceforge.net/p/swig/bugs/1309/
2022-02-01 13:09:00 +13:00
Olly Betts
f003e9bcba [Tcl] Document objects aren't destroyed on exit
Fixes https://sourceforge.net/p/swig/bugs/1330/
2022-02-01 12:47:19 +13:00
Olly Betts
9c16ce8ab3 [ocaml] Improve the Qt example
Drop a method which has been deprecated then removed in Qt (but isn't
actually used in the example anyway) and clean up the steps a bit.

The example still doesn't build for me as the final step fails with:

File "_none_", line 1:
Error: Module `Dynlink' is unavailable (required by `Camlp4')

I know next to nothing about ocaml, so that may be something I've
failed to install, but I couldn't work out what.  I think the Qt
library linking needs updating too - there doesn't seem to be a
single `-lqt` now, but I don't use Qt either.
2022-02-01 11:46:39 +13:00
Olly Betts
7813793511 [R] Fix CopyToR() generated for struct in namespace
Fixes https://sourceforge.net/p/swig/bugs/1147/
2022-01-31 12:05:09 +13:00
Olly Betts
25f996a5c8 [python] Replace uses of assert in testsuite
We're not supposed to assert for this, as mentioned in #1488.
2022-01-30 13:38:56 +13:00
Olly Betts
16238102c7 Add CHANGES entry for #655 2022-01-30 11:10:16 +13:00
Olly Betts
7b5a615e50 Merge branch 'fschlimb/using-fixes'
Fixes #655
Fixes #1488
2022-01-30 11:06:37 +13:00
Olly Betts
d9ced1e56d Coding style tweaks 2022-01-30 10:55:00 +13:00
Frank Schlimbach
4ce2964ab8 adding support for structs, docu 2022-01-30 10:55:00 +13:00
Frank Schlimbach
63452e9fc1 better handling of using directives 2022-01-30 10:55:00 +13:00
Olly Betts
d2d2bfa05f Add CHANGES entry and regression test for #676 2022-01-29 22:35:29 +13:00
Shengqiu Li
d3383e254d [Go] Fix overloaded functions with noncapitalized class as parameter type
Fixes #676 #677
2022-01-29 22:19:15 +13:00
Olly Betts
7ec2f89fe2
Remove redundant NULL checks before free()/delete (#2184)
Remove redundant NULL checks before free()/delete

The ISO C and C++ standards guarantee that it's safe to call these
on a NULL pointer, so it's not necessary for the calling code to
also check.

Fixes https://sourceforge.net/p/swig/feature-requests/70/
2022-01-29 22:03:48 +13:00
Thomas Reitmayr
5a10e10399 Ruby: Fix warnings in generated code about missing parameter in variadic macro
The Ruby C API function 'rb_funcall' is used in various places in generated
code for invoking a Ruby method without parameters. The C function uses a
variadic parameter list for the arguments passed to Ruby, therefore in these
cases the list of variadic parameters is empty.
As an optimization Ruby may implement the 'rb_funcall' function as a macro
which however will not accept an empty list of arguments for '...' as of
C99 and C++11.
In order to prevent compiler warnings, this commit replaces all such
occurrences with a call to 'rb_funcall2' (which in its current name
'rb_funcallv' is invoked by the 'rb_funcall' macro anyway, at least for
Ruby 2.6.6).
2022-01-29 11:07:57 +13:00