Commit graph

3,144 commits

Author SHA1 Message Date
Olly Betts
5b957278a8 -Wallkw now includes keywords for all languages with keyword
warnings (previously Go and R were missing).
2014-02-19 22:07:26 +13:00
Olly Betts
06e5a5fb0d [PHP] Update the lists of PHP keywords with new ones from PHP 5.4
and newer (and some missing ones from 5.3).  Reserved PHP constants
names are now checked against enum values and constants, instead
of against function and method names.  Built-in PHP function names
no longer match methods added by %extend.  Functions and methods
named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no
longer needlessly renamed.
2014-02-19 17:21:34 +13:00
Olly Betts
36c22b70bd Make PHP %keywordwarn message wording consistent with other languages 2014-02-19 16:51:31 +13:00
Olly Betts
f8a028517d Fix comment typos 2014-02-19 16:41:34 +13:00
William S Fulton
c5911cc08d Add %$isextendmember for %rename of members added via %extend 2014-02-18 23:21:46 +00:00
Olly Betts
fcf8180751 Whitespace tweaks 2014-02-17 16:27:39 +13:00
Olly Betts
b761131fec "if (strlen(msg))" -> "if (msg[0])" 2014-02-17 16:26:48 +13:00
Olly Betts
7af8b13ef7 Just call strcmp() rather than strlen() twice plus zend_binary_strcmp() 2014-02-17 16:25:29 +13:00
Olly Betts
052d0057c2 Only call strlen(lc_fname) if we are going to use the result 2014-02-17 16:24:04 +13:00
William S Fulton
fb7eb2bedf Merge branch 'master' of github.com:hfalcic/swig into hfalcic-python3-seg-fault
* 'master' of github.com:hfalcic/swig:
  Fix shadow instance creation failure in Python 3
2014-02-16 17:54:28 +00:00
William S Fulton
bd5c340062 Add <string> fragment
Removes <string> include specifically for clang
Cuts down on duplicate #include <string> in general
2014-02-15 23:30:14 +00:00
William S Fulton
078dbf8d22 Merge branch 'clang_fixes' of github.com:marvingreenberg/swig into marvingreenberg-clang_fixes 2014-02-15 22:37:40 +00:00
William S Fulton
90a9d750c9 Add support for cdata library for Java 2014-02-15 22:13:50 +00:00
William S Fulton
4ba4a02e93 Fix unused method warning in Octave 2014-02-15 18:36:01 +00:00
Harvey Falcic
c063bb8384 Fix shadow instance creation failure in Python 3
I managed to trace a very nasty Python interpreter segfault to an
allocation failure here. Adding this after the tp_new call:
if (PyErr_Occurred()) {
    PyErr_Print();
}

results in output of 'TypeError: object() takes no parameters', followed
by a segfault that takes down the Python interpeter.

The 'object' constructor doesn't seem to be suitable for instantiating
SWIG shadow instances in this way, so simply use the constructor
function in the PyTypeObject 'tp_new' slot of data->newargs.

The 'if (inst)' check after this doesn't hurt in as much as it prevented
a segfault immediately after this failed allocation, but it doesn't help
much since the null pointer dereference will probably happen sooner or
later anyway.
2014-02-14 19:19:09 -05:00
Simon Marchetto
14eebbf013 scilab: fix SWIG_Scilab_ErrorMsg(): use Scierror() instead of sciprint() 2014-02-14 15:13:40 +01:00
Simon Marchetto
d004632db5 scilab: typecheck for enum 2014-02-14 14:12:01 +01:00
Simon Marchetto
9a8b1207ca scilab: fix scilab_enums test: enum returned as double, and enum value computing 2014-02-11 16:28:57 +01:00
Simon Marchetto
680f101717 scilab: fix enum typemap, enum was not returned 2014-02-11 16:24:08 +01:00
Simon Marchetto
f624025e48 scilab: From typemaps do not have to return output argument position 2014-02-11 10:06:15 +01:00
Simon Marchetto
af94aa91e7 scilab: fix compilation error in 5.3.3 2014-02-10 10:24:46 +01:00
Simon Marchetto
dd4547acc7 scilab: fix long long typemap comment 2014-02-07 18:18:25 +01:00
Simon Marchetto
90c4cb2c26 scilab: small refactoring of scienum.swg 2014-02-07 17:29:18 +01:00
Simon Marchetto
3607b2db10 scilab: fix (check integer type) and optimize typecheck typemaps 2014-02-07 16:38:15 +01:00
Simon Marchetto
c47456a9bb scilab:implement li_typemaps test (library typemaps.i test) 2014-02-07 12:23:39 +01:00
Simon Marchetto
ccab675c57 scilab: check value and overflow errors in integer typemaps 2014-02-07 11:53:19 +01:00
William S Fulton
09bdc5f353 Merge branch 'master' of https://github.com/gjanssens/swig into gjanssens-master
* 'master' of https://github.com/gjanssens/swig:
  Guile: make scm to string conversion work with non-ascii strings
  Guile: illustrate bug in non-ascii string handling
2014-02-06 19:58:09 +00:00
Geert Janssens
c6d03a6a9f Guile: make scm to string conversion work with non-ascii strings 2014-02-05 12:17:16 +01:00
Marvin Greenberg
843aa7cd65 Work around differences in clang libc++ std::vector<bool>::const_reference
clang++ using -stdlib=libc++ defines const_reference as a class,
to map boolean vectors onto a bit set.  Because swig does
not "see" the type as "const &" it generates incorrect code for this case,
generating a declaration like:

  const_reference result;

When const_reference is a typedef to 'bool' as is the case with stdlibc++
this works.  When this is actually a constant reference, this is clearly
invalid since it is not initialized.  For libc++, this is a class
which cannot be default constructed, resulting in an error.  The fix
is to explicitly define the various accessor extensions as having a
bool return type for this specialization.
2014-02-04 16:00:12 -05:00
Marvin Greenberg
213774e0b6 Fix issue on clang about implicit instantiation of undefined template
Generated code does not include <string>, which is referenced in templates.
Clang may be incorrectly or aggresively instantiating some template.

E.g.,
import_stl_b_wrap.cxx:3199:51: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>
2014-02-04 11:55:36 -05:00
William S Fulton
0383d08444 Add new swigtype_inout.i library containing SWIGTYPE *& OUTPUT typemaps. 2014-02-04 06:54:22 +00:00
Simon Marchetto
e8fd0e506e scilab: fix and optimize integer typemaps 2014-01-31 18:04:21 +01:00
Simon Marchetto
cfc9f1398e scilab: put size_t & ptrdiff_t typemaps in separate file 2014-01-31 18:04:21 +01:00
Simon Marchetto
e9d36b6bc2 scilab: refactor runtime code 2014-01-31 18:04:21 +01:00
Simon Marchetto
530704486d scilab: small clean 2014-01-31 18:04:20 +01:00
Simon Marchetto
9aa006e62b scilab: remove typemap useless stuff 2014-01-31 18:03:52 +01:00
Simon Marchetto
7f14aa583a scilab: optimize typemap AsInt 2014-01-31 18:03:52 +01:00
Simon Marchetto
a8d020f171 scilab: simplify 'from' integer typemaps: use createScalar* functions 2014-01-31 18:03:30 +01:00
Simon Marchetto
bca49968f1 scilab: fix ret_by_value test 2014-01-30 14:11:18 +01:00
Simon Marchetto
30f4336f59 scilab: use macro SWIG_NbInputArgument() instead of Rhs() 2014-01-30 11:58:02 +01:00
Simon Marchetto
a6f824a9a8 scilab: roll back on primitive typemaps: return Scilab double on signed integers 2014-01-30 11:00:47 +01:00
Simon Marchetto
ec2d851f4f scilab: move scilab preprocessor directive before includes 2014-01-29 10:55:20 +01:00
Ian Lance Taylor
fa9a6d58ed [Go] Fix handling of C type "long" on 32-bit systems. It was broken
for C++ long& and for big-endian systems in general.
2014-01-27 17:49:35 -08:00
Ian Lance Taylor
f2dc3a9c1f [Go] Add %go_import directive. 2014-01-21 11:27:09 -08:00
William S Fulton
cc650e692e Director exceptions now derive from std::exception 2014-01-20 19:40:52 +00:00
William S Fulton
f068be89e5 Fix PHP compilation error in ZTS mode (64 bit windows) due to TSRMLS_FETCH() expansion 2014-01-16 06:48:35 +00:00
Karl Wette
5b167cc12d octave: update support to Octave version 3.8.0 2014-01-13 18:24:17 +13:00
William S Fulton
07ce3fb746 Add testcase for %attributestring on shared_ptr 2014-01-11 19:34:22 +00:00
Vadim Zeitlin
cdf1ba9120 Don't accept strings too long to fit in char[N] with trailing NUL.
It was previously possible to assign "hello" to a variable backed by char[5]
storage in C, and the array contained the correct character data but without
the trailing NUL, which was unexpected in C.

This is not allowed any more, only "helo" can fit into a char[5] now and
anything else fails the type check, just as it already happened for the longer
strings before.

Closes #122
2013-12-23 21:13:25 +00:00
Vadim Zeitlin
88a0e228a9 Change the length of strings created from fixed-size buffers.
Use the usual C rule for NUL-terminated strings instead of discarding all the
trailing NUL characters.

This was unexpected (as buffers in C code are not necessarily always padded
with NULs to their full length) and also inconsistent among languages as this
was only done for those of them using typemaps/strings.swg but not for C# or
Java, for example, which terminated the string at the first NUL even before
this change.

Notice that this patch couldn't use strlen() or wcslen() with possibly not
NUL-terminated strings, so we had to add [our own equivalents of] strnlen()
and wcsnlen() and use them instead. This required adding yet another parameter
to string typemap macros, so update the example using them accordingly too.
2013-12-23 21:12:17 +00:00