Commit Graph

156 Commits

Author SHA1 Message Date
William S Fulton 22a8088a98 Fix -Wunused-variable warning in Lua and Octave wrappers
Add bool output parameter to Swig_overload_dispatch to say when it has
generated code that will use the typecheck typemap code to help Lua and
Octave to not emit unused argv[] arrays.

Alas, resorted to warning suppression for deficient cpp11_initializer_list
typecheck typemap in cpp11_std_initializer_list testcase.
2025-06-23 21:39:49 +01:00
Olly Betts c77498d5db [Perl] Destroy C++ local variables on exception
Ensure C++ local variables get destroyed before throwing a Perl
exception.

Fixes https://sourceforge.net/p/swig/bugs/1134/
2024-10-24 16:58:17 +13:00
William S Fulton 86498e46c6 Remove -xmllang option used with -xml
which had no effect on the output.
2024-10-15 08:59:51 +01:00
William S Fulton 09001ee302 Add $isvoid special variable expansion for directors
Complete the removal of Ruby's output_helper macro and replacement
with SWIG_AppendOutput for director typemaps.
Requires $isvoid special variable support in director code.
2024-10-06 15:00:37 +01:00
Olly Betts 7e8eea4a59 [perl] Fix C++11 enum class wrapping with -const
Fixes #630
2024-09-11 16:17:03 +12:00
Olly Betts 7a8c9fdfa8 Straighten out handling of char and string constants
Fixes #904
Fixes #1907
Fixes #2579
Fixes #2990
2024-08-17 16:12:45 +12:00
William S Fulton 2c70a912a6 Add $isvoid special variable
The $isvoid special variable expands to 1 if the
wrapped function has a void return, otherwise expands to 0.

In the implementation, use a consistent variable name, returntype,
for a node's "type" attribute.

Issue #2907
2024-06-15 23:13:12 +01:00
Rose c4a4717a28 Remove redundant initialization code
Some of this code is redundant and taken care of by the initializer.
2023-10-16 16:48:04 -04:00
William S Fulton c0b36721a3 Replace Language::is_assignable with Language::is_immutable
Avoids confusion with newly created Allocate::is_assignable.
Language::is_immutable is just a wrapper around the
"feature:immutable" flag since previous commit.

is_mutable rename wip
2023-09-07 07:01:37 +01:00
William S Fulton abd299c6f4 Guile, Ocaml, Perl - add missing use of is_assignment() for variable wrappers
Don't attempt to generate a setter when wrapping
variables which have a private assignment operator as assignment is not
possible. This now matches the behaviour of all the other target languages.
2023-09-03 17:55:36 +01:00
William S Fulton 84542f6b59 Replace Language::directorsEnabled() with Swig_directors_enabled()
For use outside of the target languages for forthcoming commits
which move adding default constructors/destructors from Language
to Allocate.
2023-07-12 18:44:42 +01:00
Olly Betts 736c052d7d Remove long deprecated features
These features were all deprecated in 1.3.26 (October 9, 2005)
or before (many long before), so all more than 17 years and 3 new major
versions ago which seems more than enough time for users to have stopped
using them, especially as most emit a deprecation warning if used.
2023-06-15 15:05:15 +12:00
Olly Betts a43602cfc5 Use non-Doh-prefixed symbols outside of DOH itself
Fix a few uses of DohDelete, DohLen, DohNone and DohSetInt.
2023-06-15 14:48:41 +12:00
William S Fulton 46f7501d94 Cleanup SWIG_VERSION definition
Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.

Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this

Closes #1050
2022-10-13 19:47:43 +01:00
Olly Betts 631b41ae7b Use https for swig.org links 2022-10-06 13:16:39 +13:00
Olly Betts 8cc3d04a35 [perl] Note in -help that -proxy is on by default 2022-07-28 10:23:54 +12:00
Olly Betts b2c58115d7 Fix previous commit
Revert changes inadvertently included, and fix `=` to `==`.
2022-03-20 19:44:23 +13:00
Olly Betts 029ddab8b5 [ci] Try to fix failing appveyor python builds 2022-03-20 18:42:50 +13:00
Olly Betts 55377bdc08 Add DOH Exit() and SetExitHandler()
Exit() is a wrapper for exit() by default, but SetExitHandler() allows
specifying a function to call instead.

This means that failures within DOH (e.g. Malloc() failing due to lack
of memory) will now perform cleanup such as removing output files.

This commit also cleans up exit statuses so SWIG should now reliably
exit with status 0 if the run was successful and status 1 if there was
an error (or a warning and -Werror was in effect).

Previously in some situations SWIG would try to exit with the status set
to the number of errors encountered, but that's problematic - for
example if there were 256 errors this would result in exit status 0 on
most platforms.  Also some error statuses have special meanings e.g.
those defined by <sysexits.h>.

Also SWIG/Javascript tried to exit with status -1 in a few places (which
typically results in exit status 255).
2022-03-06 12:33:54 +13:00
Olly Betts 748a9a5452 [perl] Require at least Perl 5.8.0
As discussed and agreed in #1629, it's become hard to test with Perl
5.6 or earlier, such old versions are no longer in active use, and
4.1.0 is an appropriate time to make such a change.

I've dropped the compatibility code that was obvious to me, but there's
probably more that can be cleaned up now.
2022-01-19 10:07:30 +13:00
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
Olly Betts 0bf846f56f Eliminate unused Printf args 2021-04-13 10:43:51 +12: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 027a38c71c Remove -cppcast and -nocppcast command line options
The -cppcast option is still turned on by default. The -nocppcast option
to turn off the use of c++ casts (const_cast, static_cast etc) has been
removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
instead of C++ casts for C++ wrappers.

This a revert of commit fc79264a48f186f8bbd367e91fa9dbf9758aa092:
"Revert "Remove -cppcast and -nocppcast command line options""

The Scilab and Javascript casting problems are now fixed, so -cppcast
is now switched on as default.
2018-11-13 07:36:09 +00:00
William S Fulton fc79264a48 Revert "Remove -cppcast and -nocppcast command line options"
This reverts commit c06f2b4497.

More work to be done as it breaks Scilab and Javascript tests.
2018-11-06 17:22:05 +00:00
William S Fulton c06f2b4497 Remove -cppcast and -nocppcast command line options
The -cppcast option is still turned on by default. The -nocppcast option
to turn off the use of c++ casts (const_cast, static_cast etc) has been
removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
instead of C++ casts for C++ wrappers.
2018-11-06 10:26:06 +00:00
Olly Betts d721b4d639 Fix comment typo "aruments" 2018-05-29 09:00:18 +12:00
William S Fulton 9fb996b83f Consistent spacing in generated exception specifications 2018-05-06 09:46:37 +01:00
William S Fulton 589b7237e9 Tweak Perl's director method's $result variable generation.
Use same code as other languages - no real change in output.
2017-12-19 07:49:16 +00:00
William S Fulton 717b7866d4 Perl - Add support for missing directorfree typemaps
Related to issue #1167, to free up memory when returning reference types.
SWIG_Perl_AcquirePtr still needs implementing.
2017-12-14 07:51:45 +00:00
William S Fulton ae044c1c2f Generation of director method declarations fixes
- Fixes generation of director method declarations containing C++11 ref-qualifiers.
- Fixes generation of director method declarations returning more complex types such
  as const ref pointers.
- Rewrite Swig_method_call to use more up to date code in the core.
2017-10-23 18:55:14 +01:00
William S Fulton 3f8b8fe734 Enhancements for directorin typemaps
The directorin typemaps will now generate a temporary variable
(specified after the type), such as:
%typemap(directorin) MyType (MyType *temp) { ... use temp ... }

The shared_ptr director typemaps have been fixed for use in functions
that take more than one parameter.
2017-10-16 19:28:27 +01:00
William S Fulton ebd37155a8 Fix potential use of uninitialized variables in directors 2017-05-13 22:40:59 +01:00
Christophe Duvernois 4777a0ad3c #526 : propagate c++11 noexcept to director classes 2017-04-27 23:37:15 +02:00
William S Fulton 7ead141aa9 Fix unused variable warning in Perl wrappers 2016-05-28 00:45:24 +01:00
Petre Eftime 0a07cd4c30 Prevent redefinition warnings when compiling with SWIG<module> defined
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com>
2015-12-22 14:33:21 +02:00
William S Fulton 457e0bfa81 Typemap attribute fixes
Fix for breakages in previous few commits:
- Perl test-suite - the "varout" typemap "type" attribute is now
  expanded in typemap.c instead of Perl.cxx.
- The swig_typemap_warn errors testcase showed that $1 was no longer
  being expanded correctly when used in output typemaps (lname not set).
2015-07-24 00:32:46 +01:00
William S Fulton d64c241e1c gcc-5.1 warning fixes 2015-04-26 01:18:26 +01:00
Olly Betts 01d0ee86e0 Fix C&P references to Python in comments 2015-03-27 12:40:42 +13:00
Olly Betts 7ba0652677 Create director_common.swg for language-indep code
Move -DSWIG_DIRECTOR_STATIC handling there, so this is now supported for
all languages with director support, not just Python and PHP.
2015-03-12 19:51:11 +13:00
William S Fulton 760d603918 Warning and error fixes for Solaris Sun Studio compiler 2015-01-27 19:30:24 +00:00
William S Fulton 6029b2f7d8 Fix for 'self' being used as a parameter name 2014-10-30 07:22:59 +00:00
Robert Stone 488aed4224 apply SF Patch #350 and add testcase 2014-08-15 21:47:10 -07:00
Olly Betts 36be36d618 Eliminate needless casting away const from string constants 2014-04-30 12:00:23 +12:00
William S Fulton 279ebdc0cf Beautify director output 2013-12-23 18:21:52 +00:00
Robert Stone 43aefba9ee ran "beautify-file" make target over perl5.cxx patch hunks and rewrote callback and extend examples in the style of existing examples 2013-11-14 09:22:23 -08:00
Robert Stone e0789366e7 prefer polymorphism on existing destructor over custom destructor method 2013-11-14 08:23:46 -08:00
Robert Stone 055cbc85de fix string mangled by tidy 2013-11-13 15:04:18 -08:00
Robert Stone 7d80d9b59e eliminate dead director code and convert remaining blocks 2013-11-13 13:30:54 -08:00
Robert Stone 0901a3e867 steals python directors and adapts to perl5 2013-11-12 12:45:03 -08:00