Commit graph

5,613 commits

Author SHA1 Message Date
Vadim Zeitlin
2ab549611b Syntax check generated headers using both C and C++ compilers
For C++ tests, check header compilation using C++ compiler too, as this
detects constructs valid in C but invalid in C++ and will also be useful
for checking C++-specific parts of the headers that will be generated in
the future.
2021-11-19 00:08:44 +01:00
Vadim Zeitlin
3765a08743 Allow having C++ test cases for C backend
Support compiling and running either _runme.c or _runme.cxx files for
the given test (but not both).

Add a simple C++ test file to check that it actually works.
2021-11-19 00:08:43 +01:00
Vadim Zeitlin
5219338160 Fix previously unused access_change unit test runme file
This file had a wrong name and so wasn't used at all.

Do use it now, after renaming it to the required name and fixing its
compilation.
2021-11-10 02:17:07 +01:00
Vadim Zeitlin
e8f9bdba80 Remove wrapper aliases generation and use -namespace in the tests
The -namespace option provides a better way of using the wrapped API, so
drop the optional wrapper generation, which is useless when this option
is used and just generates many lines of unwanted junk in the header.

Update the test suite and the examples to compensate to not rely on
being able to define SWIG_DEFINE_WRAPPER_ALIASES and add -namespace
option to all C++ tests, as it's done for C# test suite, and update them
to use the correct prefix and also use the accessors for the global
variables rather than using them directly, as this is impossible when
namespace prefix is used (it would have been possible to define a
preprocessor symbol corresponding to the real variable name, but it's
arguably not worth it).

fixup! Remove wrapper aliases generation and use -namespace in the tests
2021-11-10 02:11:59 +01:00
Vadim Zeitlin
3ebf1c1769 Remove redundant cpp_basic_xxx tests
These tests duplicate the other, more complex, existing unit tests, so
it's just not useful to have them at all any more (they could have been
useful at the very beginning of C backend development, when none of the
other tests worked).
2021-11-10 00:53:39 +01:00
Vadim Zeitlin
f4ee8e5369 Fix names of enums and their elements
Use the containing class name as prefix, and add the name of the enum
itself to the prefix for the scoped enums, instead of doing something
strange and semi-random that we did before, with prefixes including the
namespace (which should never be the case without "nspace" feature), but
not the scoped enum.

This also fixes renaming of enum elements, as a side effect, which
didn't work before, add run test for enum_rename unit test to prove it.
2021-11-07 02:14:16 +01:00
Vadim Zeitlin
8014af974d Revert accidental change to Python example
This was done way back in f84342a30 (Modified parameter handling using
typemaps. 'Reference' example. Visibility hint now applies only to the
global functions., 2008-06-28), surely accidentally.
2021-11-04 01:31:06 +01:00
Vadim Zeitlin
9ac6ab3b8a Disable SWIGWARN_LANG_EXPERIMENTAL while running test suite for C
We really don't need all the warnings while testing, they are only
useful for SWIG users, not when developing it.
2021-11-02 17:51:14 +01:00
Vadim Zeitlin
2f6f6df211 Generate wrapper aliases only if requested and not by default
Defining the aliases by default results in conflicts when including
headers from multiple modules as e.g. SWIG_PendingException_get() is
defined in all of them, and could also easily result in other unwanted
clashes, so make this opt-in and update the examples and tests relying
on using the wrappers without the module prefix to define
SWIG_DEFINE_WRAPPER_ALIASES explicitly.
2021-10-20 01:57:20 +02:00
Vadim Zeitlin
e78c8f39ed Add minimal shared_ptr support
Enable the tests and support of shared_ptr in them for C (which required
disabling a previously passing, because not doing anything, attributes
test which is currently broken for unrelated reasons).
2021-10-15 01:26:22 +02:00
Vadim Zeitlin
8d7c1c4227 Eliminate a separate FAILING_CPP_TESTS variable in C Makefile
Also undo the changes to common.mk originally done in this branch and
rendered unnecessary by de5e0c865 (C++11 testing moved to a configure
option, 2013-10-08) on master.
2021-10-15 00:57:25 +02:00
Vadim Zeitlin
10dbb92182 Remove another not failing unit test
This test doesn't really work, as directors support is not implemented
at all in C backend, but remove it from here to prevent reports from
"make check-failing" about "failing test passing".
2021-10-14 19:54:50 +02:00
Vadim Zeitlin
d0e979278e Re-enable passing li_std_pair_using test
This must have been fixed by fc1ebd7c1 (Add trivial but working
std::pair typemaps implementation, 2019-08-07).
2021-10-14 19:48:59 +02:00
Vadim Zeitlin
3dd96d5b95 Allow using vector with classes without default ctor in C too
This is similar to be491506a (Java std::vector improvements for types
that do not have a default constructor., 2019-03-01) for Java, except we
don't have to bother with any compatibility constraints for this, not
yet used by anyone. module.
2021-10-07 22:03:47 +02:00
Vadim Zeitlin
0706ed4d35 Add simple std::set<> typemaps too
This is similar to the previous commit for std::map<>.
2021-10-07 22:03:47 +02:00
Vadim Zeitlin
9efb508eda Fix std::map<> typemap
Use simple fixed typemap instead of trying to use the much more complex
one from the UTL which doesn't work for C.

Add a simple test case for std::map<>.
2021-10-07 22:03:47 +02:00
Vadim Zeitlin
b88491fe89 Add at least a very minimal run test for std::vector
The test is trivial, but still better than nothing.
2021-10-07 22:03:47 +02:00
Vadim Zeitlin
e1815634ec Clean the generated headers for C too
This fixes a check-maintainer-clean problem.
2021-10-05 01:34:32 +02:00
Vadim Zeitlin
5bbaecfb81 Set LD_LIBRARY_PATH when running C examples too
This is needed to find the SWIG-generated shared library when using C
too, as it's already the case for many (but, surprisingly, not all)
other target languages.
2021-10-05 01:01:37 +02:00
Vadim Zeitlin
d2e3cce7d4 Avoid -Wformat warnings in C std_vector example
Use "%zd" for printing size_t values rather than "%d".
2021-10-05 00:57:45 +02:00
Vadim Zeitlin
03b6e2fbe6 Don't use SWIG_exit() in C examples
There doesn't seem to be any reason for using it rather than just
returning from main() as usual, and it provokes warnings about
implicitly declared function when compiling them.
2021-10-05 00:26:12 +02:00
Vadim Zeitlin
3da85eb4c5 Disable only part of cpp11_alternate_function_syntax test
Instead of skipping it entirely, just disable the part using member
function pointers, which are not supported in C backend.
2021-10-04 22:11:29 +02:00
Vadim Zeitlin
b5a8ccffa3 Explicitly refuse to wrap vararg functions
They were not supported currently, but processing them resulted in just
a warning about missing ctype typemap and generated uncompilable code.

Give an error and don't generate any code at all now, which is more
clear and helpful.

Also exclude the part of kwargs_feature test using varargs from C test
suite.
2021-10-04 22:09:12 +02:00
Vadim Zeitlin
ac4f3c78be Merge branch 'master' into C
Merge with the latest master before making more changes.
2021-10-04 16:03:36 +02:00
Vadim Zeitlin
f038fcb44d Do nothing in li_std_functors test when using Ruby 2.6
This test sporadically crashes when run in GitHub Actions environment,
so skip it for now when using the Ruby 2.6 version installed by rvm.
2021-10-01 04:26:15 +02:00
Vadim Zeitlin
4b05d8d947 Don't run ccomplextest as part of JavaScript test suite
This test currently fails due to "I" being undefined, so disable it to
let the rest of the tests to pass and add it later when this can be
fixed.
2021-10-01 02:11:11 +02:00
Vadim Zeitlin
58a49bac66 Suppress more -Wignored-qualifiers in JavaScript tests
This is probably not the greatest idea, and it would be better to change
the generated code to avoid these tests instead, but it was already done
like this for several tests, so just add two more of them that generate
warnings such as

../../member_funcptr_galore_wrap.cxx: In function ‘SwigV8ReturnValue _wrap_MemberFuncPtrs_aaa6(const SwigV8Arguments&)’:
../../member_funcptr_galore_wrap.cxx:3495:90: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
 3495 |   result = (int)((MemberFuncPtrs const *)arg1)->aaa6((short (Funcs::*const )(bool) const)arg2);
      |                                                                                          ^~~~

when using gcc 9.
2021-10-01 01:39:12 +02:00
Vadim Zeitlin
f0b3010440 Avoid another warning about deprecated implicit copy ctor
This is similar to the previous commit, but in the other direction, with
the warning being generated for the implicitly-declared copy ctor due to
having an explicitly-declared assignment operator.

And the fix is different too because we need to have an assignment
operator in this test, so define the copy ctor explicitly too.
2021-10-01 01:39:12 +02:00
Vadim Zeitlin
1f7cd009c9 Remove unnecessary warning triggering copy ctors from the test
Defining a copy ctor results in -Werror=deprecated-copy when using
implicitly-generated assignment operator with recent gcc versions, so
simply remove this copy ctor, which was apparently never needed anyhow,
to avoid it and rely on the compiler generating both the copy ctor and
assignment operator implicitly.
2021-10-01 01:39:12 +02:00
Olly Betts
a54d62b22e [UFFI] Remove code for Common Lisp UFFI
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward
to revive it in over 2 years.

See #2009.
2021-05-16 08:42:39 +12:00
Olly Betts
b7a99f22f5 [S-EXP] Remove code for Common Lisp S-Exp
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward
to revive it in over 2 years.

See #2009.
2021-05-16 08:42:39 +12:00
Olly Betts
11bb422bd3 [Pike] Remove code for Pike
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward
to revive it in over 2 years.

See #2009.
2021-05-16 08:42:39 +12:00
Olly Betts
12f3a85916 [Modula3] Remove code for Modula3
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward
to revive it in over 2 years.

See #2009.
2021-05-16 08:42:39 +12:00
Olly Betts
f3ba54c3bb [CLISP] Remove code for GNU Common Lisp
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward
to revive it in over 2 years.

See #2009.
2021-05-16 08:42:39 +12:00
Olly Betts
5f38f9cc78 [Chicken] Remove code for Chicken
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward
to revive it in over 2 years.

See #2009.
2021-05-16 08:42:39 +12:00
Olly Betts
353baebfcf [Allegrocl] Remove code for Allegro Common Lisp
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward
to revive it in over 2 years.

See #2009.
2021-05-13 10:38:40 +12:00
Olly Betts
b671a37e89 [php] Fix reserved class names TRUE, FALSE, NULL
PHPCN(x) does a string compare of x with the lower-cased class name,
so x needs to be in lowercase or else the entry has no effect.  The
entries for TRUE, FALSE and NULL weren't working as a result.
2021-05-12 16:45:42 +12:00
Olly Betts
ead90be779 [php] Fix -prefix when there are subclasses
The calls to the parent class' magic __get, __set and __isset methods
weren't getting the prefix.
2021-05-12 15:04:31 +12:00
Olly Betts
7983c83116 Fix case of expected functions and globals
The updated tests.php is case sensitive.
2021-05-04 15:49:30 +12:00
Olly Betts
c45fb9d2e1 Add member_pointer_const_runme.php 2021-05-04 15:29:46 +12:00
Olly Betts
0d028d8942 Rework tests.php
Previously this relied on getting all known classes/functions/etc
when it was loaded, and then again after the PHP module being
tested was loaded.  This approach no longer works now we've
stopped loading modules using dl(), so use ReflectionExtension
instead to get information about a specific extension.

This is likely also faster than wading through lists including
everything predefined by PHP.
2021-05-04 15:26:45 +12:00
Olly Betts
f2009ef681 Fix and restore disabled code in PHP value example 2021-05-04 14:21:13 +12:00
Olly Betts
32283991c5 Don't generate a .php wrapper file by default
It's now only generated if something to put in it is specified via:

%pragma(php) include=...

or

%pragma(php) code=...
2021-05-04 14:14:56 +12:00
Olly Betts
61f00daee4 Fix extension= value for PHP < 7.2 2021-05-04 08:04:36 +12:00
Olly Betts
586eb24efe php: Stop using dl()
With modern PHP it only works with the CLI version of PHP, so it's
better to direct users to load the extension via "extension=" in
php.ini.

Suggested by ferdynator in #1529.
2021-05-03 18:42:28 +12:00
Olly Betts
c87047fd39 Merge branch 'master' into gsoc2017-php7-classes-via-c-api 2021-05-03 16:17:02 +12:00
Olly Betts
81d1618777 Adjust director_finalizer_runme.php
Without inventing a SWIG/PHP-specific mechanism, we can't really
finalise objects in the way the testcase expects, so adjust the
testcase minimally so we avoid triggering C++ undefined behaviour
(use-after-free).
2021-05-03 16:07:50 +12: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
William S Fulton
5f8768daed Support testing on AIX for tcl
Contributed by Tony Reix

Closes #1922
2021-04-28 00:04:50 +01:00
William S Fulton
429288fa1c Fix Java %interface family of macros
when returning by const pointer reference

Closes #1987
2021-04-27 23:37:18 +01:00