Commit Graph

5496 Commits

Author SHA1 Message Date
Erez Geva be5efafc1d [R] Fix use of %typemap(rtypecheck). 2023-05-23 09:49:31 +12:00
Erez Geva 7b9b5565b3 Add D language typemaps
- "char *STRING, size_t LENGTH"
 - argc and argv multi-argument

Fixes #2552

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2023-05-20 16:17:00 +12:00
Erez Geva eaabe152b3 [D] Fix to support recent D releases
Fixes #56
Fixes #2538
Fixes #2570
2023-05-20 15:22:12 +12:00
Olly Betts a8b1f262ef Relocate a comment to where it makes sense 2023-05-20 09:26:16 +12:00
Olly Betts d8887091fe Support deducing decltype for false and true 2023-05-20 09:09:48 +12:00
Olly Betts f215365609 Merge branch 'cpp14-auto-return-type' 2023-05-19 12:02:30 +12:00
Olly Betts 707aaa8b3b Stop defining SWIGOPT_* preprocessor symbols
SWIG no longer defines preprocessor symbols corresponding to
command line options (e.g. `-module blah` was resulting in
`SWIGOPT_MODULE` being set to `blah`).  This feature was added in
2001 so that "[m]odules can look for these symbols to alter their
code generation if needed", but it's never been used for that
purpose in over 20 years, and has never been documented outside of
CHANGES.

Closes: #2595
2023-05-19 11:59:43 +12:00
Olly Betts 546878c968 Add comment explaining new parser rule 2023-05-18 16:34:34 +12:00
Olly Betts 5104040dc9 Partial support for auto without trailing return type
This is a C++14 feature.

SWIG can now parse some cases of this.  The limitation is that there
can either be nothing or `const` between the `)` and the end of the
parameter list and the `{` at the start of the body.

Fixes #2446
2023-05-18 15:19:23 +12:00
Olly Betts da8d7f0ec3 Define __STDC__ to 1 rather than an empty value
The new value matches how C/C++ compilers define __STDC__.
2023-05-18 12:45:31 +12:00
Olly Betts de1327fb15 Allow defining __cplusplus on the command line
The default value for __cplusplus is now 199711L rather than defining
it to have the value __cplusplus.

Fixes #2591
2023-05-18 12:45:31 +12:00
Olly Betts ca25fa6c4e Define all predefined symbols after option parsing
We want -U to act consistently on predefined symbols and we can't
predefine all symbols before option parsing (since some rely on
options (-c++ defines __cplusplus, -python defines SWIGPYTHON,
etc) so handle them all after.
2023-05-18 12:45:31 +12:00
Olly Betts 51647c02b4 Relocate comment to where it makes sense 2023-05-18 12:45:31 +12:00
Olly Betts fba4a82865 Add new -U command line option
This undefines a preprocessor symbol.

See #2591
2023-05-18 12:45:31 +12:00
Olly Betts b8e756de4c Clean up handling of -D a little 2023-05-18 08:44:25 +12:00
Olly Betts 87a84672d6 Improve --help output for -D
Show that it takes an optional value.
2023-05-18 08:42:44 +12:00
Olly Betts 0102ff3369 Remove duplicate defining of __cplusplus 2023-05-18 08:31:16 +12:00
Olly Betts cee3d5b1ef Merge branch 'arbitrary-decltype-expressions' 2023-05-18 08:07:49 +12:00
William S Fulton ec1a29c72e More maintainable warning message 2023-05-17 20:59:17 +01:00
Olly Betts 086cb543f9 Simplify grammar rules for alternative start symbols
We have some rules to allow parsing just a type, parameter or parameter
list.  Instead of using a semicolon as an end marker for these, just use
the special END token which always marks the end of input.
2023-05-18 07:00:16 +12:00
Olly Betts 86f437e3f6 Support parsing arbitrary expression in decltype
Use parser error recovery to skip to the closing matching `)` and
issue a warning that we can't deduce the decltype for the expression
(like we already do for any expression which isn't a simple variable
or similar).

Fixes #1589
Helps #2335 (fixes the decltype-related examples)
2023-05-17 18:09:27 +12:00
Olly Betts 59fa42a751 Use Putc instead of Append on a temp 1 or 2 char string
Easier to read code and probably a little more efficient.
2023-05-16 11:52:29 +12:00
Olly Betts c9bcc39540 Improve docs for Scanner_skip_balanced() return value 2023-05-16 11:44:56 +12:00
Olly Betts af87945aea Clean up double spaces between words in comments 2023-05-16 09:55:49 +12:00
Olly Betts e5650d8fa4 Emit extra message for missing typecheck typemap
This has been reported too many times (#2404 #2528 #2581 recently) so
explain that this may break dispatch and link to the relevant
documentation.
2023-05-16 09:35:35 +12:00
Olly Betts 8a9628e2b9 Use strchr/Strchr for single character searches
This can be more efficient than using strstr/Strstr with a single
character search string.

GCC is able to optimise strstr() with a single character literal
search string to strchr(), but clang doesn't, and likely no compiler
can for Strstr() (unless some sort of inter-object optimisation such
as LTO is used) since the literal string is in a different source file
to the strstr() call.
2023-05-15 16:19:17 +12:00
Momtchil Momtchev 2dfa6d6b84 support check typemaps in JS 2023-05-11 23:09:19 +02:00
Olly Betts b1388bcbf9 Parse storage class more flexibly
Previously we had a hard-coded list of allowed combinations in the
grammar, but this suffers from combinatorial explosion, and results
in a vague `Syntax error in input` error for invalid (and missing)
combinations.

This means we now support a number of cases which are valid C++
but weren't supported.

Fixes #302
Fixes #2079 (friend constexpr)
Fixes #2474 (virtual explicit)
2023-05-11 13:54:30 +12:00
Olly Betts 0fa2ab8945 Removed unused default parameter value 2023-05-08 15:45:12 +12:00
Olly Betts 15b739d60e [PHP] Wrap method with both static and non-static overloads
We now wrap this as a non-static method in PHP, which means the static
form only callable via an object.

Previously this case could end up wrapped as static or non-static
in PHP.  If it was wrapped as static, attempting to call non-static
overloaded forms would crash with a segmentation fault.

See #2544
2023-05-08 15:44:24 +12:00
William S Fulton e0c7f81ba5 Merge branch 'typedef-namespace'
* typedef-namespace:
  Partial revert of previous commit for typedefs
  add an unit test
  tentative fix for typedef/using declaration to struct typedef

Conflicts:
	CHANGES.current
2023-05-06 11:36:30 +01:00
William S Fulton 65be881295 Partial revert of previous commit for typedefs
Setting current symbol table for a typedef seems wrong.
No difference to test-suite though.

Testcase rename for C++11 testing and minor adjustments.

Issue #2550
Closes #2551
2023-05-06 11:13:23 +01:00
Momtchil Momtchev e92ffa84ef tentative fix for typedef/using declaration to struct typedef 2023-05-06 10:54:14 +01:00
Olly Betts ece7ba0218 [D] Fix typo in -d2 option description 2023-05-04 13:18:26 +12:00
Erez Geva 63b1293e1a Drop D version 1
See #2538
2023-05-04 13:18:10 +12:00
Olly Betts 2860e28bd5 Fix typo: "temporal" which should be "temporary" 2023-04-27 10:35:22 +12:00
Momtchil Momtchev df2ef48ed7 try to ninja fix jsc
I don't have access to jsc atm
2023-04-26 18:26:31 +02:00
Momtchil Momtchev edd55210bb take into account numinputs when counting arguments 2023-04-26 18:23:53 +02:00
Olly Betts b508598a42 [js] Turn on C++ output for node too
Nodejs is like V8 and needs C++ output enabled when wrapping C code.

The testsuite was masking this bug by using SWIG options
`-v8 -DBUILDING_NODE_EXTENSION=1` rather than `-node` when testing
with nodejs, while the javascript examples currently all seem to all get
processed with -c++.
2023-04-22 13:33:46 +12:00
Momtchil Momtchev 64516bb2a3 use the renamed name when creating a constant 2023-04-22 08:51:27 +12:00
Olly Betts de4e3b454e Fix #ifdef and #ifndef to work inside a %define
Previously they were silently ignored in this context (but #if defined
already worked here if you need a workaround which works for older
versions).

Fixes #2183
2023-04-21 07:40:25 +12:00
Olly Betts c538bd24c4 Restore handling for '<<' in array size
I accidentally dropped this in 8fb15fcc92.
2023-04-20 14:53:30 +12:00
Olly Betts 752ec61d27 Add missing newline on new error message 2023-04-20 14:26:53 +12:00
Olly Betts 8fb15fcc92 Improve error for array size with a '<' character
Previously we'd fail an assertion and dump core, which isn't nice:

Bad template type passed to SwigType_remember: a(std::numeric_limits< unsigned char >::max()).unsigned char
swig: ../../Source/Swig/typesys.c:1709: SwigType_remember_clientdata: Assertion `0' failed.
Aborted (core dumped)

We also now know that this situation can be triggered by particular
user inputs, so an assertion is not an appropriate check anyway.

Now we report an error and exit with non-zero status:

:1: Error: Array size expressions containing a '<' character not fully supported

The `:1:` part isn't ideal but happens because the SwigType doesn't seem
to have file:line information.

See #2486.
2023-04-20 14:14:43 +12:00
Olly Betts 9873ff107a Remove remaining traces of PHP7 support
The bulk of this was already removed in
e3b112c69c.
2023-04-20 13:45:30 +12:00
Clément DAVID e351d7faee scilab: add a gateway xml v6 with full function names 2023-04-20 07:34:19 +12:00
Olly Betts 26dfe33948 Merge branch 'macro-partial-expansion' 2023-04-19 16:00:03 +12:00
Olly Betts 043bdf5677 Copy over missing parts of macro expansion code
We need to insert newlines for a multi-line macro invocation, and
we shouldn't leak memory.
2023-04-19 14:52:40 +12:00
Momtchil Momtchev d39cee1ce1 suppress a warning 2023-04-14 10:25:45 +02:00
Momtchil Momtchev 24756d1bf9 fix code readability issues 2023-04-14 09:55:29 +02:00