Commit graph

1,831 commits

Author SHA1 Message Date
Olly Betts
631b41ae7b Use https for swig.org links 2022-10-06 13:16:39 +13:00
William S Fulton
ba279ae939 Add support for parsing C++11 final classes
Such as:

  class X final {};

This no longer gives a syntax error.
This change has introduced one more shift-reduce conflict in the parser.
with a conflict with a C style variable declaration with name final:

  class X final;

resulting in a syntax error (for C++ not C). This is an an unusual style
for C++ code and more typical declarations do work:

  X final;

Closes #672
2022-10-05 22:42:17 +01:00
Olly Betts
06296a7128 Report errors in preprocessor expressions by default
Until now SWIG quietly ignored such errors unless -Wextra (or -Wall
which implies -Wextra) was passed, but this is unhelpful as it hides
problems.  To illustrate this point, enabling this warning by
default revealled a typo in the preproc_defined.i testcase in
SWIG's own testsuite.

If you really don't want to see this warning, you can suppress it
with command line option -w202 or by using this in your interface
file:

%warnfilter(SWIGWARN_PP_EVALUATION);

Both will work with older versions of SWIG too.

Fixes #1465
Fixes #2389
2022-10-05 17:07:06 +13:00
Olly Betts
befcd1bf58 Fix SWIG version reference in recent doc change
The upcoming release is 4.1.0 not 4.2.0.
2022-10-05 13:48:21 +13:00
Olly Betts
3096e8aa00 Fix doc typo 2022-10-05 12:41:34 +13:00
Olly Betts
4ac3c87a29 Sort out predefined SWIG-specific macros
Ensure that SWIG_VERSION is defined both at SWIG-time and in the
generated C/C++ wrapper code (it was only defined in the wrapper
for some target languages previously).

SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers
to match behaviour for all other target languages.

Stop defining SWIGVERSION in the wrapper.  This only happened as a
side-effect of how SWIG_VERSION was defined but was never documented and
is redundant.

The new testcase also checks that SWIG is defined at SWIG-time but not
in the generated wrapper, and that exactly one of a list of
target-language specific macros is defined.

Fixes #1050
2022-10-05 12:40:15 +13:00
William S Fulton
28202a0e27
Merge pull request #2249 from geographika/pcre-nuget
Update Windows CMake builds to use NuGet package for PCRE2
2022-09-30 23:43:45 +01:00
William S Fulton
77b08daca7 Add DohSortedKeys function
Returns a list of sorted keys in a DOH Hash.
2022-09-30 22:48:04 +01:00
Olly Betts
3bf1da4298 Fix a few documentation typos 2022-09-29 18:17:32 +13:00
Olly Betts
9a4dea06c8 [php] Add php:allowdynamicproperties feature
This follows PHP 8.2 deprecating dynamic features.

The new feature also provides a clean way to fix the remaining PHP
test case failure under PHP 8.2.
2022-09-29 18:16:51 +13:00
sethg
e45d8d0efd Split build and install 2022-09-27 15:02:58 +02:00
sethg
95d255e16e Switch Action and docs to use PowerShell 2022-09-27 09:48:19 +02:00
Markus Friedrich
d1b7765838 Extended the documentation for octave operator overloading
Octave has more operators than C++. These operators can be overloaded for
the type swig_ref using the standard Octave Object Oriented Programming mechanism.
This is now added to the documentation.
2022-09-18 20:19:39 +02:00
William S Fulton
dad7c93ca0 Provide SWIGTYPE MOVE typemaps in swigmove.i
For implementing full move semantics when passing parameters by value.
Based on SWIGTYPE && and std::unique_ptr typemaps which implement move
semantics.

Added for all languages, but untested for: Go, Ocaml, R, Scilab (and
unlikely to be fully functional for same reasons as for std::unique_ptr
support).

Issue #999
2022-09-16 08:36:25 +01:00
William S Fulton
2212af3f4f rvalue reference outputs
Document rvalue reference outputs behaviour
Test rvalue reference outputs
2022-09-08 08:46:32 +01:00
William S Fulton
0b1d3e3e86 Docs on rvalue parameter changes 2022-09-02 08:24:30 +01:00
William S Fulton
ca9eebcb8d Octave - SWIG now marshalls a C/C++ NULL pointer into the null matrix, []
SWIG has always marshalled the null matrix into a NULL pointer; this remains
and now we have consistency in representing a NULL pointer.

This is a pre-requisite for a pending commit to fully support std::unique_ptr.
2022-08-31 19:40:13 +01:00
William S Fulton
c10a84c775 Cosmetic stray semi-colon removal after %typemap using quotes 2022-08-31 19:40:13 +01:00
William S Fulton
ec965840ce Cosmetic stray semi-colon removal after %typemap 2022-08-20 15:29:49 +01:00
William S Fulton
1f2338bf41 Typo fix in Go.html 2022-08-11 07:20:04 +01:00
Olly Betts
6bf2138fa0 [guile] Update status of Guile 1.8.0 support
See #1624
2022-08-05 10:21:20 +12:00
William S Fulton
c16d25d9d6 Update docs regarding 'modern' c++ standards testing 2022-08-04 09:03:32 +01:00
Olly Betts
fd0a47fee8 [guile] Update supported guile versions in docs
Document that Guile 2.2.x and 3.0.x work.

Document that Guile 1.8.x is believed to still work, but that we're
no longer able to easily test this.
2022-08-04 10:40:10 +12:00
William S Fulton
3bc754da10 html corrections 2022-07-30 17:42:44 +01:00
William S Fulton
d93a8c2db8 Minor editing of C++20 docs 2022-07-30 17:41:13 +01:00
Olly Betts
64d72483c6 Clean up Tcl version docs and handling
We require 8.4 now which simplifies things a bit.
2022-07-28 14:30:43 +12:00
Olly Betts
848cb3f95e Document lack of separate ISO C tag namespace
This is a long-standing limitation, but only seems to have been reported
once back in 2004.

Nobody's cared enough to address it in 18 years, but we can at least
document it in the manual rather than only in a source code comment in
Source/Swig/symbol.c.

Addresses https://sourceforge.net/p/swig/bugs/429/
2022-07-28 07:06:00 +12:00
Olly Betts
8182740b8e Add documentation 2022-07-27 09:36:27 +12:00
Olly Betts
02b4bd8eca Fix spaceship operator bugs, document, add tests
Remove some erroneously added brackets_increment() calls.

Reject <=> in preprocessor expressions with a clear error message (it
seems it isn't supported here - clang and gcc don't at least).

The type returned by `<=>` is not `bool`.  We pretend it's
`int` for now, which should work for how it's likely to be used
in constant expressions.

Fixes #1622
2022-07-27 09:12:40 +12:00
Olly Betts
06d375cdab [Tcl] Fix handling of long long on 32-bit platforms
Fixes https://sourceforge.net/p/swig/bugs/977/ reported by Vera and
Kjell Wooding.

Closes #2331
2022-07-27 07:53:45 +12:00
William S Fulton
8b654afdef Merge branch 'unique_ptr-inputs'
* unique_ptr-inputs:
  std::unique_ptr std::auto_ptr tidyup
  Add support for std::auto_ptr inputs
  Cosmetic formatting and doc updates in std_unique_ptr.i files
  Add Perl support for std::unique_ptr inputs
  Add Ruby support for std::unique_ptr inputs
  Add Python support for std::unique_ptr inputs
  Add C# support std::unique_ptr inputs
  Java unique_ptr test ownership enhancement to test
  Java unique_ptr enhance test for double release
  SWIGTYPE && input typemaps now assume object has been moved
  Add Java support for std::unique<T> for input parameters.

Closes #692

Conflicts:
	CHANGES.current
2022-07-19 20:26:18 +01:00
William S Fulton
1b63af0f2c std::unique_ptr std::auto_ptr tidyup
Add docs on additional support
Additional testing for invalid usage for parameter inputs
2022-07-19 20:23:06 +01:00
Olly Betts
0b9d4eff09 Update everything for dropping Python 3.2 support 2022-07-19 13:20:07 +12:00
Olly Betts
892557e799 Improve #include guard macros
Avoid using reserved identifiers such as `_DOHINT_H` (fixes #1989),
fix cases where the name doesn't match the filename, and make the naming
more consistent and less likely to collide with include guards in other
headers.
2022-07-19 09:35:46 +12:00
Olly Betts
c25d0d707a Minor PHP documentation improvements 2022-07-11 16:39:17 +12:00
Olly Betts
22a4355f34 [xml] Move to "Experimental" target language status
The XML target language support is not in good shape and is likely to be
removed unless somebody steps up to bring it up to the expected standard
(it fails to even meet the criteria for "Experimental" currently).

Closes #2213
2022-07-08 16:34:19 +12:00
Olly Betts
a5380ed1c5 Update docs for C++ attribute support 2022-07-08 15:57:29 +12:00
William S Fulton
299880e6a6 Add std::unique support
Simple copy of current auto_ptr support (just suppport for
functions returning std::unique_ptr).

Closes #1722
2022-07-02 16:17:18 +01:00
William S Fulton
bf36bf7d8a Movable and move-only types supported in "out" typemaps.
Enhance SWIGTYPE "out" typemaps to use std::move when copying
objects, thereby making use of move semantics when wrapping a function returning
by value if the returned type supports move semantics.

Wrapping functions that return move only types 'by value' now work out the box
without having to provide custom typemaps.

The implementation removed all casts in the "out" typemaps to allow the compiler to
appropriately choose calling a move constructor, where possible, otherwise a copy
constructor. The implementation alsoand required modifying SwigValueWrapper to
change a cast operator from:

  SwigValueWrapper::operator T&() const;

to

  #if __cplusplus >=201103L
    SwigValueWrapper::operator T&&() const;
  #else
    SwigValueWrapper::operator T&() const;
  #endif

This is not backwards compatible for C++11 and later when using the valuewrapper feature
if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
in custom "out" typemaps for C++11 and later code:

1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
2. Change the cast, for example, from static_cast<X &> to static_cast<X &&>, using the
   __cplusplus macro if all versions of C++ need to be supported.

Issue #999
Closes #1044

More about the commit:
Added some missing "varout" typemaps for Ocaml which was falling back to
use "out" typemaps as they were missing.

Ruby std::set fix for SwigValueWrapper C++11 changes.
2022-06-30 17:26:48 +01:00
William S Fulton
28036e5a16 Documentation for attribute support in $typemap. 2022-06-04 14:19:15 +01:00
William S Fulton
da40946aaa Merge branch 'typemap-colon'
* typemap-colon:
  Incoporate review suggestions
  Allow referencing of typemap keywords inside of "$typemap("
2022-06-01 07:57:01 +01:00
William S Fulton
34c219b5f7 Merge branch 'imfunc'
* imfunc:
  Add special variable imfuncname expansion for C# and D
  Test and document imfuncname special variable expansion
  Update docs.
  Also expose  in proxyClassFunctionHandler
  Expose  to javaout typemaps.

Conflicts:
	CHANGES.current
2022-05-30 19:45:28 +01:00
William S Fulton
954f29b032 Add special variable imfuncname expansion for C# and D
Same functionality as Java
2022-05-30 19:43:04 +01:00
William S Fulton
62e0685df6 Test and document imfuncname special variable expansion 2022-05-30 19:00:04 +01:00
William S Fulton
d60724b636 Merge branch 'more_argcargv'
* more_argcargv:
  Document argc argv library
  argcargv.i cosmetic updates
  Typemaps for (int ARGC, char **ARGV) fixup
  Fix argcargv.i in Perl5, Tcl, PHP Add missing type map for type check. Add testing of argcargv.i for Perl5, Tcl, PHP and Ruby.
  Add Lua test for argcargv.i
  Add argcargv.i to more languages: Perl 5, Tcl, PHP
  Add argcargv.i to Lua
2022-05-15 19:42:25 +01:00
William S Fulton
6860e2bc03 Document argc argv library 2022-05-15 19:12:39 +01:00
William S Fulton
fd846be18b Remove some usage of strdup
To fix visual c++ warning:
  warning C4996: 'strdup': The POSIX name for this item is deprecated.
2022-05-07 07:09:44 +01:00
William S Fulton
b35ebc81a9 Doxygen comments take precedence over the autodoc feature.
If a "docstring" feature is present it will still override a Doxygen comment.
If the "autodoc" feature is also present, the combined "autodoc" and "docstring"
will override the Doxygen comment. If no "docstring" is present then the
"autodoc" feature will not be generated when there is a Doxygen comment.

This way the "autodoc" feature can be specified and used to provide documentation
for 'missing' Doxygen comments.

Closes #1635
2022-04-06 08:08:14 +01:00
sethg
e60a02941f Update Windows CMake builds to use NuGet package for PCRE2 2022-03-31 19:08:46 +02:00
William S Fulton
1db04bf322 Improvements to the -debug command line options
The debug command line options that display parse tree nodes
(-debug-module, -debug-top, -debug-symtabs) now display previously hidden
linked list pointers which are useful for debugging parse trees.

Added new command line option -debug-quiet. This suppresses the display
of most linked list pointers and symbol table pointers in the parse tree nodes.

The keys in the parse tree node are now shown in alphabetical order.
2022-03-25 23:34:52 +00:00