Commit Graph

148 Commits

Author SHA1 Message Date
Christophe Duvernois 4777a0ad3c #526 : propagate c++11 noexcept to director classes 2017-04-27 23:37:15 +02:00
Olly Betts 0aac18b2a1 [PHP] destroy_globals function is empty, so drop
We can just pass NULL instead.
2016-12-30 16:02:01 +13:00
Olly Betts 36ee653d3b Omit module functions when there's no code
MSHUTDOWN, RINIT, RSHUTDOWN and MINFO are often empty, so check and
omit them if this is the case, and set the module structure entry to
NULL instead.  Reduces code size, number of external functions on the
module, and runtime overhead a little (RINIT and RSHUTDOWN are called
on every request when used with a webserver).
2016-12-30 15:36:08 +13:00
Olly Betts cf60bb8895 [php7] Drop special code for PHP < 5.4 2016-12-30 14:56:53 +13:00
Olly Betts 4a2ede0820 [PHP7] Remove lingering generated ZTS code
ZTS is gone in PHP7 so these are dead code.
2016-12-30 12:41:19 +13:00
Olly Betts 2b4c1cdd5e Fix "set but not used" warning 2016-12-13 11:40:45 +13:00
Olly Betts 2aa2219f28 Fix reference example under PHP 7.1
PHP 7.1 no longer supports calling methods with fewer parameters
than declared, so we need to generate __construct() with default
values for all but the first parameter.
2016-12-06 11:01:55 +13:00
Olly Betts da1dd2ffd2 [PHP] Pick a default dtor which can't collide 2016-12-01 15:09:53 +13:00
Olly Betts 76a98b0b1a [PHP] Emit at most one copy of the default dtor
Can reduce the wrapper source size significantly, though at least
with recent GCC the stripped compiled size seems unchanged.
2016-12-01 14:21:29 +13:00
Olly Betts 659116a1b2 Fix memory leaks introduced by previous commit 2016-12-01 14:04:10 +13:00
Olly Betts 4993991d28 [PHP] Only emit one copy of each distinct arginfo
Previously we emitted a separate one for every wrapped function,
but typically many functions have the same number of parameters
and combinations of parameters passed by reference or not.

This change significantly reduces both the size of the generated
wrapper, and of the compiled PHP extension module (e.g. by ~6% for
the stripped extension module for Xapian's PHP7 bindings).
2016-12-01 13:05:41 +13:00
Olly Betts 75a00cd15e [PHP7] Make default C++ extension .cxx
This is SWIG's default for every language except PHP, and now is a
good time to make this change so that once we drop PHP5 support, we'll
have the same default everywhere.  It's easy to override the default
with -cppext cxx to get the PHP5 behaviour.
2016-11-30 13:27:13 +13:00
Olly Betts 1169874f59 [PHP] Add support for PHP7.
PHP5's C extension API has changed substantially so you need to use
-php7 to specify you want PHP7 compatible wrappers.
Fixes https://github.com/swig/swig/issues/571
2016-11-30 13:05:59 +13:00
Olly Betts 1adfe2f537 [PHP] Fix code generated for feature("director:except")
Previously the return value of call_user_function() was ignored and we
checked an uninitialised value instead.  Fixes #627.  Based on patch
from Sergey Seroshtan.
2016-09-25 14:42:04 +13:00
Olly Betts 26bbc96d58 Arrange to return after calling zend_throw_exception()
Fixes github issue#240.
2016-09-16 17:54:02 +12:00
William S Fulton ac495d5c66 Merge branch 'char-escaping'
* char-escaping:
  Add missing string_constant.i testcase
  changes file update for char wrappers
  C# char wrappers fixes for enum values, static const member char values and %csconst
  D testing added for %dmanifestconst and char constants
  Fix wrapping D constants using %dmanifestconst
  Php fix for enum value of '\0'
  Fix static const char member variables wrappers with %javaconst(1).
  Expand char testing in enums and %constant
  Java char changes file update
  Java enum and static member variable escaping fix for chars
  Add tests for enum values and static const member variables chars containing escape sequences
  Minor documentation tweak

Conflicts:
	CHANGES.current
2016-03-12 23:27:51 +00:00
William S Fulton 539aca58a5 Php fix for enum value of '\0' 2016-03-12 00:26:49 +00:00
William S Fulton 21ee09fc19 Multiple inheritance warning wording tweak 2016-03-06 10:45:39 +00: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 6a61f8271f Php fix for -Wmissing-field-initializers warning
Use ZEND_FE_END (introduced sometime around 5.2) to obtain the correct
number of arguments for zend_function_entry. Fallback to the original
3 argument initializer if not defined, however, this will not fix the
initializer warning though for some older versions of PHP.
2015-12-19 16:21:23 +00:00
William S Fulton edcdaaec16 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
Nils Gladitz 925cec3a82 Add a space between literal and string macro
In C++11 a space between a literal and string macro is required.
2015-07-03 20:59:23 +01: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
Olly Betts b3003f1f9f [PHP] When wrapping a returned resource as an object, check if all
cases wrap it in the same class, and if so eliminate the pointless
switch statement wrapper we previously generated.
2015-01-23 13:56:13 +13:00
Olly Betts 0dd685bad2 Fix PHP crash in director_finalizer 2015-01-14 15:38:55 +13:00
Olly Betts ea5be4e508 Fix PHP backend for default_args testcase 2015-01-14 10:44:54 +13:00
Olly Betts 682b4dd843 [PHP] Fix segfault in director upcall check
Manifest only when using PHP built with ZTS enabled.
2015-01-12 13:53:01 +13:00
William S Fulton 06e361dbf2 Fix linux gcc warnings and strtol corrections 2015-01-11 17:30:25 +00:00
Olly Betts cd16059c66 Provide -cppext as a general command line option
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend).  Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
2015-01-08 10:54:37 +13:00
Olly Betts 1a99212c2c [PHP] Add support for specifying any PHP interfaces a wrapped class
implements, e.g.: %typemap("phpinterfaces") MyIterator "Iterator";
2014-09-12 12:48:37 -03:00
Olly Betts 14c2cf3407 PHP: Fix memory leak if a director method is passed Null for self 2014-08-29 16:28:00 -03:00
Olly Betts 73bb909bae [PHP] The generated __isset() method now returns true for read-only properties. 2014-05-01 14:37:58 +12:00
Olly Betts 36be36d618 Eliminate needless casting away const from string constants 2014-04-30 12:00:23 +12:00
Olly Betts f563069e7b [PHP] Fix wrapping director constructors with default parameters with a ZTS-enabled build of PHP. 2014-04-03 10:38:19 +13:00
Olly Betts 2a3981289d [PHP] Pass the ZTS context we already have to avoid needing to
call TSRMLS_FETCH, which is relatively expensive.
2014-04-02 23:35:59 +13:00
Miklos Vajna 227192f80a Fix Examples/php/pointer to work with PHP 5.5
With this, all examples work with PHP 5.5 for me.
2013-12-12 15:52:51 +13:00
Olly Betts cecd89f66f [PHP] The usage of $input in PHP directorout typemaps has been
changed to be consistent with other languages.  The typemaps
provided by SWIG have been updated accordingly, but if you
have written your own directorout typemaps, you'll need to
update $input to &$input (or make equivalent changes).

*** POTENTIAL INCOMPATIBILITY  ***
2013-12-12 15:40:15 +13:00
William S Fulton d15220cba4 Remove a couple of unused variable warnings in generated code 2013-10-18 19:10:42 +01: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 c4d40c7b64 PHP directors - generate call_user_function on one line 2013-10-01 22:13:57 +01:00
Olly Betts 24ff00690f Use ZVAL_STRINGL instead of ZVAL_STRING to set funcname as we know the length at swig-time 2013-04-14 08:03:46 +12:00
Olly Betts a16dc29046 Removed unused Printf parameter 2013-04-14 06:14:47 +12: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 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
Olly Betts 0dd11cdd8d Fix to work with a ZTS build of PHP (broken in 2.0.7) 2013-01-08 18:33:47 +13:00
William S Fulton 8a8c8e377b gcc-4.6 warning fix
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13972 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-12-15 18:33:02 +00:00
William S Fulton 89052f3b0a Fix Strcmp - it didn't have consistent null pointer handling - revert to what it used to be - a lightweight wrapper around strcmp which means functions once again must not pass in null to it.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13943 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-12-02 13:36:13 +00:00
William S Fulton d93dc0f8e2 Distinguish between an "abstract" attribute on a class containing a list of abstract members and an "abstract" flag on pure virtual methods - renamed former to "abstracts"
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13935 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-24 14:13:58 +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