Commit graph

22,974 commits

Author SHA1 Message Date
William S Fulton
590de1642e MS_WIN64 no longer needed on Appveyor MinGW for Python
Not sure why - 64bit must be default now.
Fixes Appveyor and Python C++20 tests as the -std=c++20 flags were
not being passed to the compiler.
2022-07-31 01:02:08 +01:00
William S Fulton
db854dcef4 GHA: Python is already installed 2022-07-31 00:58:35 +01:00
William S Fulton
eb8346b958 Convert cpp20_spaceship_operator php test to python 2022-07-31 00:58:35 +01:00
William S Fulton
4a8447d503 Add c++-20 testing on experimental GHA Ubuntu 22.04 2022-07-31 00:58:22 +01:00
William S Fulton
c1bfda210f Fix configure messages when C++20 is not available 2022-07-31 00:42:08 +01:00
William S Fulton
3bc754da10 html corrections 2022-07-30 17:42:44 +01:00
William S Fulton
d93a8c2db8 Minor editing of C++20 docs 2022-07-30 17:41:13 +01:00
William S Fulton
26fbf99901 Add Tcl support for std::unique_ptr and std::auto_ptr
Equivalent to Ruby/Python implementations.
2022-07-30 16:43:05 +01:00
Olly Betts
dce4254377 [php] Fix handling of friend functions
We were incorrectly considering them as methods of the class they
are a friend of for the purposes of calculate PHP type declarations.
2022-07-29 16:37:22 +12:00
Olly Betts
379d5b6742 Fix warning suppression in cpp20_lambda_template 2022-07-29 16:29:32 +12:00
Olly Betts
64d72483c6 Clean up Tcl version docs and handling
We require 8.4 now which simplifies things a bit.
2022-07-28 14:30:43 +12:00
Olly Betts
8cc3d04a35 [perl] Note in -help that -proxy is on by default 2022-07-28 10:23:54 +12:00
Olly Betts
848cb3f95e Document lack of separate ISO C tag namespace
This is a long-standing limitation, but only seems to have been reported
once back in 2004.

Nobody's cared enough to address it in 18 years, but we can at least
document it in the manual rather than only in a source code comment in
Source/Swig/symbol.c.

Addresses https://sourceforge.net/p/swig/bugs/429/
2022-07-28 07:06:00 +12:00
Olly Betts
346ede21c3 Fix spaceship preproc tests for previous change 2022-07-27 18:17:31 +12:00
Olly Betts
100d4d5350 Only recognise spaceship operator for C++
I don't think any valid C program can contain `<=>` in a tokenisable
context, but it's more helpful to fail with a syntax error at SWIG
parse time and not potentially generate C code trying to use `<=>` in
an expression which then fails at compile time.
2022-07-27 13:46:53 +12:00
Olly Betts
54ddefe410 Revert "Modify fix for << in array size"
This reverts commit 0ff9a0959a.

The modified fix breaks Java and C#, where C constant expressions
get used in the generated target language code in some cases.

Revert this fix for now.
2022-07-27 13:45:08 +12:00
Olly Betts
6e931b0399 Revert "Fix handling of array whose size contains <<"
This reverts commit 2227dc9e53.
2022-07-27 13:45:03 +12:00
Olly Betts
0ff9a0959a Modify fix for << in array size
The previous fix broke testcase arrays for Go.
2022-07-27 12:25:27 +12:00
Olly Betts
2227dc9e53 Fix handling of array whose size contains <<
Fixes https://sourceforge.net/p/swig/bugs/983/
2022-07-27 10:29:33 +12:00
Olly Betts
24ec116742 Merge branch 'cpp20-template-lambdas'
Fixes #1678
2022-07-27 09:36:42 +12:00
Olly Betts
8182740b8e Add documentation 2022-07-27 09:36:27 +12:00
Olly Betts
88f227b5da Add testcase 2022-07-27 09:30:39 +12:00
Olly Betts
e31de2aebb Tidy up indentation 2022-07-27 09:30:30 +12:00
Zackery Spytz
61928bd882 Add support for C++20 "templated" lambdas
Such as `auto lambda = []<typename T>(std::vector<T> t){};`
2022-07-27 09:15:32 +12:00
Olly Betts
4c14dc7010 Merge branch 'spaceship' 2022-07-27 09:12:47 +12:00
Olly Betts
02b4bd8eca Fix spaceship operator bugs, document, add tests
Remove some erroneously added brackets_increment() calls.

Reject <=> in preprocessor expressions with a clear error message (it
seems it isn't supported here - clang and gcc don't at least).

The type returned by `<=>` is not `bool`.  We pretend it's
`int` for now, which should work for how it's likely to be used
in constant expressions.

Fixes #1622
2022-07-27 09:12:40 +12:00
Zackery Spytz
cb887ed2d4 Add support for the <=> operator (C++20) 2022-07-27 09:12:40 +12:00
Olly Betts
36310c04e5 Add comments to clarify how #define gets wrapped
It took me a while to fully get my head around this, and I'd like to
help out future developers.
2022-07-27 09:10:51 +12:00
Olly Betts
b57248cc1a [php] Add parentheses around $value when casting
In some cases $value can be an expression without parentheses around
it, and we want to cast the result of the whole expression.
2022-07-27 08:49:15 +12:00
Olly Betts
a80e748565 [php] Add missing qualification in test suite helper
This would cause an error due to failing to find the function to
call if certain testcase checks failed.

Bug introduced in eaf311a650
2022-07-27 08:47:53 +12:00
Olly Betts
8c5c14b9ad Merge branch 'cpp-testing'
Closes #2329
2022-07-27 07:55:24 +12:00
Olly Betts
06d375cdab [Tcl] Fix handling of long long on 32-bit platforms
Fixes https://sourceforge.net/p/swig/bugs/977/ reported by Vera and
Kjell Wooding.

Closes #2331
2022-07-27 07:53:45 +12:00
Olly Betts
4f44d0a1ea Attempt to fix cpp11_result_of for MSVC
MSVC fails with:

cpp11_result_of_wrap.cxx(3211): error C2672: 'test_result_impl': no matching overloaded function found
cpp11_result_of_wrap.cxx(3211): error C2893: Failed to specialize function template 'std::result_of<Fun(Arg)>::type test_result_impl(Fun,Arg)'
cpp11_result_of_wrap.cxx(3150): note: see declaration of 'test_result_impl'
cpp11_result_of_wrap.cxx(3211): note: With the following template arguments:
cpp11_result_of_wrap.cxx(3211): note: 'Fun=double (__cdecl *)(double)'
cpp11_result_of_wrap.cxx(3211): note: 'Arg=int'

Try making the second parameter double to match the template.
2022-07-26 15:28:52 +12:00
Olly Betts
4a15f3934d Fix MSVC error in nested_class.i
MSVC now fails with:

error C4596: 'foo': illegal qualified name in member declaration

Such redundant qualification is invalid.  Compilers used to be
permissive here (so it's useful for SWIG to handle it), but compilers
increasingly complain about it so adjust the testcase to show the
compiler a valid version, and only test the redundant qualification
with SWIG.
2022-07-26 15:28:51 +12:00
Olly Betts
9d3fb41eef Fix MSVC error in cpp_typedef.i
MSVC in C++20 mode complains:

error C7626: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes

The struct member in question isn't actually used by the testcase, so
just remove it.
2022-07-26 15:28:51 +12:00
Olly Betts
c759da250f Add tests for binary integer literal constants 2022-07-26 15:28:51 +12:00
Olly Betts
1bfe88eeda Support binary integer literals in the preprocessor 2022-07-26 15:28:51 +12:00
Olly Betts
3140acd748 Run C++14 and C++17 tests with appropriate compiler
Previously these testcases had C++98 fallback versions of the
testcase code to feed to the compiler if it didn't set __cplusplus to a
value which indicated support for the required C++ version, as well as
the C++14 or C++17 code which was fed to SWIG, and also to the compiler
if it was new enough.

This approach allowed some testing of such features with an
older compiler, but it complicates the testcases and not all new
C++ features can be tested in this way (indeed some of the existing
testcases don't fully exercise the feature being tested currently).

C++14 and C++17 support are also much more widespread than they
were 3.5 years ago when this approach was first implemented, so
it makes more sense to switch C++14 and C++17 testcases to require
a suitable compiler, like how C++11 testing always has.
2022-07-26 15:28:51 +12:00
Olly Betts
07f0b732ba Add machinery for C++14, C++17 and C++20 testing
Support running testcases conditional on the compiler supporting
a each language version, like we already handle C++11.

Currently no testcases are actually run in this way for these
newer language versions.
2022-07-26 15:28:51 +12:00
Olly Betts
b5ad734fdf Update AX_CXX_COMPILE_STDCXX to upstream serial 14
Only functional change is the addition of C++20 support.
2022-07-26 15:28:51 +12:00
Olly Betts
8038cd7ac3 Fix C++20 compatibility in testcases 2022-07-26 15:28:51 +12:00
Olly Betts
de5ce08a7d Fix operator precedence in preprocessor expressions 2022-07-26 14:18:38 +12:00
William S Fulton
5a4baece4f Remove redundant check for NULL in char * typemaps
No need to check for NULL before calling delete/free.
Anyone using typemaps_string_alloc with custom allocators and
deallocators need to ensure the custom allocators behave in the
same way as the standard deallocators in this respect.
2022-07-24 17:54:40 +01:00
Olly Betts
0e0f283e48 Fix friends_runme.*
Most of these test D_d twice when they really should be testing
D_d once and D_i once (the variable name is `di` and the values
assigned are integers).

This was wrong in the initial version for Python in
708021a809 and it looks like subsequent
additions for other languages have just copied that mistake.
2022-07-22 17:50:47 +12:00
Olly Betts
2aa979b7a0 [php] Add friends_runme.php 2022-07-22 17:40:40 +12:00
Olly Betts
eaf311a650 [php] Make $message optional in testsuite helpers
Also report the filename and line in the testcase where a check
function which fails was called from.
2022-07-22 17:39:15 +12:00
William S Fulton
7592722e39 Order of interfaces generated for %interface macros
Ensure the order of interfaces generated in proxy interfaces for the
%interface family of macros is the same as that parsed from the bases in C++.
2022-07-20 19:50:53 +01:00
Olly Betts
ccccd6fc1f Add director_multiple_inheritance to CPP_TEST_CASES 2022-07-20 15:06:56 +12:00
Olly Betts
e23d912b49 [python] Fix inheriting from multiple director classes
Fix mishandling of a Python class inheriting from multiple SWIG-wrapped
director classes.

Fixes #422
Fixes https://sourceforge.net/p/swig/bugs/1379/
2022-07-20 14:18:49 +12:00
Olly Betts
8a03c7d555 Remove nonsensical comment
A testcase can't be a copy of itself.

Seems to have been accidentally added in
50fec04759.
2022-07-20 14:18:49 +12:00