Commit Graph

255 Commits

Author SHA1 Message Date
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
luz.paz 60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
William S Fulton 5ccae6eac6 Merge branch 'goatshriek-ruby-alias'
* goatshriek-ruby-alias:
  Fix ruby %alias directive for native c functions
2018-04-07 12:34:08 +01:00
Olly Betts 3bea8f6b7e [Ruby] Pass Qnil instead of NULL to rb_funcall()
This silences GCC -Wconversion-null warning (on by default with recent
GCC).
2018-04-03 18:01:58 +12:00
Joel Anderson a1cea4f483 Fix ruby %alias directive for native c functions
Using the %alias directive on native C functions causes swig to segfault due to
a dereference of klass (which is NULL for native C functions) in the
defineAliases function of the Ruby module. This commit adds support for an alias
of native C functions for both separate module as well as global functions, as
well as three test cases for the %alias directive of the Ruby module.

Fixes:
mod.i
%module ruby_alias
%alias get_my_name "nickname,fullname";
%inline %{
const char *get_my_name(){
  return "Chester Tester";
}
%}
$ swig -ruby mod.i
Segmentation fault

Signed-off-by: Joel Anderson <joelanderson333@gmail.com>
2018-03-22 08:05:01 -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
Olly Betts 7a3cfdb013 Fix GCC 7 warnings
From -Wimplicit-fallthrough which is now enabled by -W.
2016-12-21 13:05:20 +13:00
Olly Betts f474577d5b Fix "set but not used" warning 2016-12-13 13:58:51 +13: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
William S Fulton 70f5a9ceed Merge branch 'tamuratak-master'
* tamuratak-master:
  Revert introduction of minor memory leak in Ruby wrappers
  ruby: use nodeType attribute to determine whether functions are constructors.       get return type each time.
2016-05-17 20:05:20 +01:00
William S Fulton 1330337491 Revert introduction of minor memory leak in Ruby wrappers 2016-05-17 20:04:24 +01:00
William S Fulton 38f8fd811c Merge branch 'ruby-module-docstring'
* ruby-module-docstring:
  Ruby module docstring avoid memory leak
  Ruby add support for docstring option in %module()
2016-05-17 19:04:20 +01:00
Takashi Tamura 7ef1b04a86 ruby: use nodeType attribute to determine whether functions are constructors.
get return type each time.
2016-04-08 12:15:55 +09:00
William S Fulton 21ee09fc19 Multiple inheritance warning wording tweak 2016-03-06 10:45:39 +00:00
Olly Betts f910607e26 Fix typo: "neccessary" -> "necessary" 2016-01-12 13:37:39 +13:00
Aurelien Jacobs 2daf3fa237 Ruby module docstring avoid memory leak 2016-01-12 01:05:10 +01:00
Aurelien Jacobs c63562744b Ruby add support for docstring option in %module()
This was already documented but not actually implemented.
2016-01-11 16:33:26 +01:00
William S Fulton 2d094d7d9f Alternative solution for Ruby unbalanced braces 2016-01-10 20:19:35 +00:00
Aurelien Jacobs 982b14370f Ruby fix unbalanced braces causing issue with the YARD parser 2016-01-09 21:14:59 +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 e12277a469 Ruby shared_ptr fixes for use with minherit 2015-10-01 22:36:01 +01:00
William S Fulton 14e1c47288 Fix Ruby smartptr feature for classes in a namespace 2015-09-25 22:58:00 +01:00
William S Fulton c482637167 Add Ruby shared_ptr support 2015-09-25 22:57:59 +01:00
William S Fulton 4d4c7eca9a Ruby free function declaration change
Declare function taking void * parameter to be more flexible for upcoming
smart pointer support.
2015-09-14 07:19:57 +01:00
William S Fulton 567d4690cf Fix ruby warning using clang in director exception code
Suppresses warning:
  error: control may reach end of non-void function [-Werror,-Wreturn-type]
The UNUSED macro is not expanded in ruby.h for rb_exc_raise for clang when
it ought to be.
For patch #512
2015-08-31 14:05:31 +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 bfde148887 The kwargs feature no longer turns on compactdefaultargs for languages that don't support kwargs.
Affects all languages except Python and Ruby.

Closes #242
2014-10-21 07:34:51 +01:00
Olly Betts 36be36d618 Eliminate needless casting away const from string constants 2014-04-30 12:00:23 +12: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
William S Fulton 779dc402b6 Fix a const_cast in generated code that was generating a <:: digraph when using the unary scope operator (::) (global scope) in a template type.
Affects Python, Ruby, Ocaml.

Based on SF patch #341.
2013-07-01 20:00:12 +01: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
William S Fulton 0d2c459046 Remove some unused code and pointless variable assignments
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13932 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-23 07:38:00 +00:00
William S Fulton 5b4ba0b0d6 Remove unnecessary null checks or fix potential null dereferences
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13925 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-20 23:29:57 +00:00
William S Fulton 0b0d5b1124 Fix uninitialised member var
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13909 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-19 19:41:12 +00:00
William S Fulton d918bddfc0 Fix segfaults when using filename paths greater than 1024 characters in length - use String * and heap instead of fixed size static char array buffers.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13904 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-18 00:45:18 +00:00
William S Fulton fd24b188e2 Fix Coverity 'Uninitialized pointer fields' - member variables are now initialized
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13887 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-14 22:17:28 +00:00
William S Fulton 5a1e82a2f4 Remove DohClose (Close) and replace with calls to DohDelete (Delete) to fix some minor memory leaks in most uses of NewFile.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13885 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-14 22:16:07 +00:00
William S Fulton b1ee062d2a Cosmetic variable renaming for consistency across language modules
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-10-27 17:38:05 +00:00
William S Fulton f6229d4b73 Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously the name was ignored during the typemap search. Implemented by ensuring the 'type' attribute in the Node is set up correctly and using the usual Swig_typemap_lookup on the Node.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13873 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-10-27 17:37:34 +00:00
William S Fulton ecac2d2a68 Improve nullptr constant wrapping
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13842 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-20 19:09:38 +00:00
William S Fulton 5d678a7b09 Fix regression introduced in r12784
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12883 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-22 21:14:09 +00:00