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.
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.
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
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).
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.
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.
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.
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).
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.
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".
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.
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<>.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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