Commit graph

21,802 commits

Author SHA1 Message Date
Vadim Zeitlin
2d13e18d07 Allow reassigning scoped_dohptr
Not being able to do it is too restrictive in practice and just forces
to use raw DOH pointers, which is not really less dangerous than adding
the assignment operator and reset() method to this class.
2019-08-05 14:44:47 +02:00
Vadim Zeitlin
649a1c3c98 Provide trivial SWIG_exception definition even in C mode
This is not really useful, but gets rid of an annoying warning when
running li_constraints.ctest unit test.
2019-08-05 14:15:18 +02:00
Vadim Zeitlin
bd02ba19d8 Fix getNamespacedName() and reuse it for enum
There doesn't seem to be any unit tests covering this, but the old code
was wrong because it didn't replace periods used as namespace separators
with underscores, which resulted in periods appearing in the output when
nested namespace were used.

Fix this and also reuse the now fixed getNamespacedName() in
getEnumName() which contained its own buggy version of the same code.
2019-08-05 02:23:52 +02:00
Vadim Zeitlin
10b73ad2c1 Remove unnecessary override of classDeclaration()
It doesn't seem necessary to muck with sym:name explicitly when we
construct the fully qualified name using getNamespacedName() later
anyhow.

Moreover, the overridden version had a bug which resulted in a crash in
template_empty_inherit unit test and simply removing it entirely allows
the test to pass (without breaking anything else).
2019-08-05 02:02:25 +02:00
Vadim Zeitlin
ba564d4e4e Fix memory leak of getProxyName() return value
This is done not so much to fix the memory leak per se (as there are
gazillions of other ones remaining), but to show that the return value
of getProxyName() does need to be freed, as this was unclear previously,
with it being freed in one place where this function was used, but not
in the other one, here.

Also state this explicitly in the function comment.
2019-08-05 01:37:46 +02:00
Vadim Zeitlin
8f1b9dbbc5 Improve constants handling
Handle char constants defined using #define or %constant correctly.

Also handle static member const variables, which didn't work at all
before, and quote values of such variables of char type.
2019-08-04 17:47:54 +02:00
Vadim Zeitlin
dc2af47e1d Fix warning about undeclared strcmp() in a unit test
Just include the header declaring it in the test code.
2019-08-04 17:47:36 +02:00
Vadim Zeitlin
ef77cefd8d Rename operator() for C in functors unit test
This ensures that these operators are actually wrapped, instead of just
being ignored with warnings.
2019-08-04 17:45:59 +02:00
Vadim Zeitlin
11d7f09f7a Fix bug with mangling enums in overloaded function names
Don't generate "enum foo" in the function names, which obviously can't
contain spaces.

This allows another unit test to pass.
2019-08-04 17:09:57 +02:00
Vadim Zeitlin
9615021a91 Micro optimize handling of prefix in get_mangled_type()
Don't bother with a bunch of Replaceall() calls if the prefix is empty
to begin with, which is commonly the case.

No real changes.
2019-08-04 17:09:57 +02:00
Vadim Zeitlin
579c441aa9 Get rid of rather useless "goto" statement in get_mangled_type()
It's not significantly simpler to use "goto" in this function, so just
replace it with "return".

Also remove the unnecessary checks for strings being deleted being
non-null, as they always are.

No real changes.
2019-08-04 17:09:57 +02:00
Vadim Zeitlin
cb3d9df000 Fix bug with return value of getNamespacedName()
We need to make a copy instead of directly returning whatever sym::name
points to, as this value can be overwritten with something different
later, resulting in weird problems with the value of "proxyname"
attribute changing "on its own".

After this bug fix, a few more unit tests pass.
2019-08-04 15:45:54 +02:00
Vadim Zeitlin
fb0579a0df Simplify SWIGTYPE "in" typemap
There is no need to check if the input is non-null, as the effect of
both branches of "if" is the same anyhow.

Also get rid of an extra and unnecessary block.

No real changes.
2019-08-04 15:23:35 +02:00
Vadim Zeitlin
61e13eb42b Get rid of useless IS_SET_TO_ONE macro
Just use the standard GetFlag() instead.
2019-08-04 14:59:48 +02:00
Vadim Zeitlin
d1f8d46528 Fix some very wrongly indented lines and "else" style
Consistently put "else" on the same line as closing "}" from the
matching "if", if any.

No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
92c922c841 Remove trailing whitespace
No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
0599b77377 Remove useless overridden extendDirective()
There is no need to override it just to call the base class version.

Also remove the outdated comment, as %extend is supported currently
(albeit with some bugs remaining).

No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
7bef0b704d Remove unnecessary "virtual" keywords
Don't mark functions not intended to be overridden (nor overriding those
in the base class) as "virtual", this is useless and confusing.

No real changes.
2019-08-04 14:57:08 +02:00
Vadim Zeitlin
83e9d50763 Remove unused C::int_string field
This was simply never used at all.
2019-08-04 14:43:02 +02:00
Vadim Zeitlin
290f49a2c1 Remove unused C::tl_namespace member
This was never set to anything, so just drop it.
2019-08-04 14:41:29 +02:00
Vadim Zeitlin
d9b3453763 Add missing SWIGIMPORT to function declarations
This went unnoticed under Linux, but would have resulted in link errors
for all functions under MSW.
2019-08-04 14:33:34 +02:00
Vadim Zeitlin
b4d08c1787 Get rid of special ctor/dtor handling in C module
By delegating to the base class instead we not only save quite a few
lines of code, but gain support for ctors/dtors defined using %extend,
which didn't work before, allowing to reenable some of the previously
failing tests.
2019-08-04 02:22:16 +02:00
Vadim Zeitlin
875217b1e2 Disable more tests not passing since the last merge with master
They should be fixed later, but for now let at least the working unit
tests pass.
2019-08-03 17:27:45 +02:00
Vadim Zeitlin
bbac8ca521 Don't reimplement base class version of globalfunctionHandler()
This is useless and the C-specific version didn't handle template
methods added with %extend correctly, so removing this code also fixes
some (but not all yet) failures in extend_template_method.cpptest unit
test.
2019-08-03 14:40:09 +02:00
Vadim Zeitlin
b0d99a1cc3 Don't emit functions added by %extend into C structs
This is never going to work and just results in generating uncompilable
code.

In principle, we could either generate wrappers for these functions
while still handling the struct as a plain C struct, or switch to
generating class-like wrappers for it if it's %extended with any
functions, but for now just ignore them as this is the simplest thing to
do.

Incidentally, this makes the default_args_c test pass again now, after
the last merge with master pulled in such %extend directives into it.
2019-08-03 02:37:18 +02:00
Vadim Zeitlin
690bf8e020 Replace SWIG_exit() with just exit() in test code
SWIG_exit() is not declared anywhere, so would need to be explicitly
declared to avoid warnings, while exit() can be declared just by
including <stdlib.h>, so prefer to use the latter, especially because
they're one and the same anyhow.
2019-07-24 20:47:59 +02:00
Vadim Zeitlin
fe5f367709 Show "C" in the list of languages at the end of configure
If C module wasn't disabled, show that the tests and examples will be
available for it too.
2019-07-24 20:35:42 +02:00
Vadim Zeitlin
55741f9e31 Merge branch 'master' into C 2019-07-24 20:26:50 +02:00
Vadim Zeitlin
0ff6893b2d Make Python module source non-executable again
0f88f9997c (probably accidentally) changed
this file to be executable, undo this as it doesn't make sense for a
source file to have this mode.

See #1242.
2019-07-24 20:10:35 +02:00
William S Fulton
c7aae28a99 Remove failing wchar c# test 2019-07-24 08:35:13 +01:00
William S Fulton
10f0329e4b Add changes entry for C# std::wstring marshalling fix 2019-07-23 22:16:04 +01:00
William S Fulton
55b5552a6a More C# wstring testing 2019-07-23 19:57:06 +01:00
William S Fulton
2d36b3468a More C# wstring testing 2019-07-23 19:41:25 +01:00
William S Fulton
eb6efdb60b C# wstring testing
Test code from issue #1530
2019-07-23 19:10:35 +01:00
smithx
03f7745364 fix undesirable wstring encoding at return value marshalling for C# 2019-07-22 19:11:21 +01:00
smithx
8f6d97ab8c fix undesirable wstring encoding at return value marshalling for C# 2019-07-22 19:11:21 +01:00
William S Fulton
a9a7b03ba6 Split testcases li_std_wstring.i and li_std_wstring_inherit.i
Not many languages have support for std_wstring.i, so disable testing
for these languages until added.
2019-07-22 19:05:21 +01:00
William S Fulton
5131096b80 li_std_wstring test rename to li_std_wstring_inherit
This testcase was only run in Ruby and Python and implements an
obscure feature where a C++ class inherits from a std::wstring.

The li_std_wstring test is left in place to be modified in next commit
for more regular wstring testing across all languages.
2019-07-18 19:49:50 +01:00
William S Fulton
d6ec7eb278 Update changes file with recent Python improvements 2019-07-18 07:59:34 +01:00
William S Fulton
835c732506 Merge branch 'py3.8'
* py3.8:
  Use PyObject_GC_UnTrack in lieu of the old variant
2019-07-18 07:55:33 +01:00
William S Fulton
c8b1eed8ce Merge branch 'annotation_quoting'
* annotation_quoting:
  Examples: Unify string quoting in the Python sources
  Test-suite: Unify string quoting in the Python sources
  Tools: Unify string quoting in the Python sources
  Generator: Unify string quoting in generated Python sources
  Generator: Remove trailing whitespaces in the Python module
2019-07-18 07:23:06 +01:00
Christian Kellner
db9822788e Use PyObject_GC_UnTrack in lieu of the old variant
The _PyObject_GC_UNTRACK[1] macro got deprecated in 3.6 and finally
removed in 3.8. Therefore use PyObject_GC_UnTrack instead.

[1] https://docs.python.org/3/c-api/gcsupport.html#c._PyObject_GC_UNTRACK
2019-07-17 11:15:17 +02:00
William S Fulton
53b425b638 Merge branch 'bugfix/616-csharp-bool-array'
* bugfix/616-csharp-bool-array:
  Add changes entry to fix C# bool[]
  Quieten failing bool[] testcase message
  Skip failing bool[] test cases when running under mono
  Change C# bool[] typemaps to marshall as 1-byte
2019-07-16 19:51:32 +01:00
William S Fulton
a7fa720c1f Add changes entry to fix C# bool[] 2019-07-16 19:50:35 +01:00
William S Fulton
fc9c37192b Quieten failing bool[] testcase message 2019-07-16 19:46:32 +01:00
Gareth Francis
15ad67c37f Skip failing bool[] test cases when running under mono 2019-07-15 16:08:31 +01:00
Dmitry D. Chernov
f88ba7c182 Examples: Unify string quoting in the Python sources 2019-07-14 14:12:23 +10:00
Dmitry D. Chernov
fa5f519bf9 Test-suite: Unify string quoting in the Python sources 2019-07-14 12:58:21 +10:00
Dmitry D. Chernov
c4ad3480bd Tools: Unify string quoting in the Python sources 2019-07-14 11:15:36 +10:00
Dmitry D. Chernov
c20b6f5b0e Generator: Unify string quoting in generated Python sources 2019-07-14 11:08:17 +10:00