Commit graph

100 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
ee9e436971 Fix -Wmisleading-indentation in Octave wrappers 2022-09-20 22:31:50 +01:00
Olly Betts
f5e2d044df Remove set but not used variables
Highlighted by clang-15 warnings such as:

warning: variable 'index' set but not used [-Wunused-but-set-variable]
2022-06-30 12:52:37 +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
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
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
Vadim Zeitlin
cd526caed4 Harmonize parameters in autodoc in Ruby and Octave with Python
Backport changes to Python version of make_autodocParmList() to Ruby and
Octave modules, which use similar code.

In particular, this improves handling of parameters clashing with the
language keywords/reserved words for these languages as well.
2019-01-21 01:08:45 +01: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 fc79264a48:
"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
luz.paz
6f69830321 follow-up typos 2018-05-17 10:26:00 -04: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
a91d1b5a42 Remove unused kwnames generated variable in Ruby wrappers
This seems to be from some left over Python kwargs / unfinished kwargs support
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
ec8a5c71cb Fixes for Octave and missing -Wmissing-field-initializers in swig_octave_member 2015-12-19 16:21:22 +00:00
William S Fulton
faeaacf112 smartptr feature support - factor out common code 2015-09-25 22:57:59 +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
Jeremy
2696a6e0ff Updated usage string for -cppcast/-nocppcast in octave.cxx 2015-01-09 14:51:44 -05:00
Jeremy
e301457a43 Attempting fixes for Octave shared_ptr support 2015-01-05 10:53:06 -05:00
William S Fulton
376ebc2d85 Revert "Octave: whitespace/indentation/style cleanup of octave.cxx"
This reverts commit 5ac475cbcd.

Reverting a series of Octave commits for re-applying again without
incorrect whitespace changes.
2014-10-09 19:34:06 +01:00
William S Fulton
23373e9ffd Revert "Octave: cleanup/restructure library files"
This reverts commit bf12d76d03.

Reverting a series of Octave commits for re-applying again without
incorrect whitespace changes.
2014-10-09 19:34:02 +01:00
William S Fulton
a9c9c9c848 Revert "Octave: remove unused field SwigOctClass::constructor_doc"
This reverts commit afa9affcd9.

Reverting a series of Octave commits for re-applying again without
incorrect whitespace changes.
2014-10-09 19:33:40 +01:00
Karl Wette
afa9affcd9 Octave: remove unused field SwigOctClass::constructor_doc 2014-10-05 20:54:20 +02:00
Karl Wette
bf12d76d03 Octave: cleanup/restructure library files
- Restructure runtime code into declarations, function
  and class definitions, and initialisation code
- Rename internal functions/types to follow SWIG_Octave...
  or SwigOct... naming styles
- Style/comment/whitespace cleanups
2014-10-04 19:18:32 +02:00
Karl Wette
5ac475cbcd Octave: whitespace/indentation/style cleanup of octave.cxx
- Used "astyle -A10 -s2 -N -p -H -U -k1" for style cleanup
- Replaced NewString("") with NewStringEmpty()
- Used 'w' instead of 'f' for Wrapper() objects
2014-10-04 13:29:46 +02:00
Karl Wette
ecf28da5a9 Octave: remove deprecated -global/-noglobal command-line arguments 2014-05-29 23:42:55 +02:00
Karl Wette
ebe1338015 Octave: whitespace/indentation cleanup of octave.cxx 2014-05-29 23:42:55 +02:00
Olly Betts
36be36d618 Eliminate needless casting away const from string constants 2014-04-30 12:00:23 +12:00
William S Fulton
2121e1217e Ensure -c++out is not used with -c++
Error checking for this combination implemented as well as correcting
Octave

Also refactor, replacing CPlusPlusOut variable with cparse_cplusplusout
for an implementation which more closely resembles cparse_cplusplus which
is also required in both .c and .cxx files.
2013-12-12 20:52:44 +00:00
Vladimir Kalinin
b63c4839fe Nested classes support
Closes #89
Squash merge branch 'master' of https://github.com/wkalinin/swig into wkalinin-nested

By Vladimir Kalinin
* 'master' of https://github.com/wkalinin/swig:
  CPlusPlusOut mode for Octave
  nested class illustration
  fixed "Abstract" flag for nested classes added an example enabled anonymous nested structs runtime test
  porting
  warnings disabled
  porting fixes
  java runtime tests ported
  nested class closing bracket offset fixed
  removed double nested template (not supported by %template parsing)
  template_nested test extended
  parent field made public
  property access fixed
  replaced tabs with spaces
  warning W-reorder
  deprecated warnings removed, derived_nested runtime test added
  optimized string indenting
  Nested classes indenting
  nested classes docs
  fixed the order in which flattened inner classes are added after the outer
  Private nested classes were getting into the type table.
  Java getProxyName() fix for nested classes fixes the case when nested classes is forward declared
  Fix for a case when a nested class inherits from the same base as the outer. (Base class constructor declaration is found first in this case)
  merge fix
  nested C struct first immediate declaration incorrectly renamed sample fixed
  tests updated to reflect nested classes support
  Java nested classes support (1)
  flattening should remove the link to the outer class
  access mode correctly set/restored for nested classes
  nested templates should be skipped while flattening (template nodes themselves, not expanded versions) also non-public nested classes should be ignored
  If nested classes are not supported, default behaviour is flattening, not ignoring flag "nested" is preserved, so, the nested classes can be ignored by user
  nested workaround test updated
  template instantiated within a class is marked as nested for ignoring purposes
  %ignore not applied to the nested classed, because "nested" flag is set too late
  typedef name takes precedence over the real name (reason?)
  unnamed structs should be processed for all the languages
  nested C struct instances are wrapped as "immutable"
  tree building
  typedef declaration for unnamed C structures fixed
  nested classes "flattening"
  fixed %ignoring nested classes
  renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface
  renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface
  tree iteration fix
  dirclassname variable names unified memory issue fixed
  merge error
  ignore unnamed structs for C++
  unnamed nested C structs naming & unnesting
  class added to classes hash under typedef name
  private nested classes skipped
  test updated due to nested templates support
  anonymous structs with inheritance fixed nested_class test to allow anonymous structs w/o declarator
  tests updated: nested workaround removed from namespace_class.i propagated nested template declaration to the C++ file
  injected members scope
  nested tempplates fixes, nested structures in "C" mode parsing added utility function "appendSibling" (like "appendChild")
  nested unnamed structures parsing fixes, access mode restored on nested class end, tdname is properly patched with outer class name prefix
  memory management fixes
  nested templates (1)
  Nested unnamed structs
  Nested class support (1)
  Nested class support (1)
2013-11-29 07:02:34 +00:00
William S Fulton
bcb7aee022 Merge branch 'master' into gsoc2009-matevz
Conflicts:
	Examples/Makefile.in
	Examples/guile/Makefile.in
	Lib/php/php.swg
	Makefile.in
	Source/CParse/parser.y
	configure.ac
2013-10-10 07:26:09 +01:00
Karl Wette
0d05b2a2d1 Octave: make texinfo strings static (internal linkage) 2013-06-13 17:46:34 +02:00
Karl Wette
2a3e687c19 Octave: fix bugs in output of cleanup code
Closes #35
2013-04-17 22:23:27 +01:00
Karl Wette
52c754a22d Minor fix to Octave autodoc generation for functions returning structs
Patch #27

- see also git commit 72ffdb930d
2013-03-09 00:10:41 +00:00
Sylvestre Ledru
e0b14786d6 Fix some useless code detected by scan-build (LLVM/Clang) 2013-03-08 20:53:18 +00:00
William S Fulton
d172e3d0ed Apply patch SF #334 - Fix Python default value conversions TRUE->True, FALSE->False. 2013-01-29 07:31:11 +00:00
William S Fulton
e805d5f925 Merge branch 'master' into gsoc2009-matevz
parser.y still to be fixed up

Conflicts:
	Doc/Devel/engineering.html
	Examples/Makefile.in
	Lib/allegrocl/allegrocl.swg
	Lib/csharp/csharp.swg
	Lib/csharp/enums.swg
	Lib/csharp/enumsimple.swg
	Lib/csharp/enumtypesafe.swg
	Lib/java/java.swg
	Lib/python/pydocs.swg
	Lib/r/rtype.swg
	Source/Include/swigwarn.h
	Source/Modules/octave.cxx
	Source/Modules/python.cxx
	Source/Modules/ruby.cxx
	Source/Swig/scanner.c
	Source/Swig/stype.c
	Source/Swig/swig.h
	configure.ac
2013-01-28 07:01:37 +00:00
William S Fulton
7841a0d097 Remove cvs/svn Id strings 2013-01-12 01:21:16 +00:00
Karl Wette
e60ae2d81d octave: Simplified module loading.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13941 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-28 20:22:56 +00:00