Commit Graph

1049 Commits

Author SHA1 Message Date
William S Fulton 2acdfd77e9 SwigType * handling corrections
Further corrections to pass SwigType * to methods expecting types
instead of passing readable type strings.

Required reworking code that adds a fake inheritance for smart pointers
using the smartptr feature. Swig_smartptr_upcast() added as a support
function for this.
2022-11-09 22:11:27 +00:00
William S Fulton ea3f043920 SwigValueWrapper and SwigType * correction
Modifying the type by adding in SwigValueWrapper needs to follow the
normal SwigType conventions for correct and proper type handling.
2022-11-08 09:11:35 +00:00
William S Fulton 52edda64c1 Fix infinite loop handling non-type template parameters
Fixes infinite loop due to () brackets in a non-type template
parameter containing an expression

Fixes #2418

Non-trivial expressions are still not qualified properly though.
2022-11-05 08:41:10 +00:00
William S Fulton 15c433c5f9 C89 fixes 2022-10-14 22:34:18 +01:00
William S Fulton 46f7501d94 Cleanup SWIG_VERSION definition
Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.

Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this

Closes #1050
2022-10-13 19:47:43 +01:00
William S Fulton 2f55379687 Improve director unwrap detection for the return type
Resolve the return type to correctly determine if the type is a pointer or
reference to a director class.

SwigType_refptr_count_return() recently added as a simpler fix is no
longer needed.

The conventional approach of using the "type" rather than "decl" to
analyse the return type is used instead too.

Issue #1823
2022-10-10 08:45:26 +01:00
William S Fulton 4a397869a2 Merge branch 'director-unwrap-result'
* director-unwrap-result:
  Unwrap director classes only when returning a pointer or reference to an object
2022-10-07 18:41:14 +01:00
Olly Betts 80d05a1a6c Eliminate 2 redundant copies of swig banner
We had a banner for C, a banner for target languages (parameterised
to allow the comment sequence to be specified) and a special banner
for XML files in scilab.cxx.

The XML variant was only needed because the standard banner contains
`--` for a hyphen, so we now use ` - ` for that instead.

The C banner now calls Swig_banner_target_lang() with a suitable
comment sequence to print the actual banner text.
2022-10-06 14:33:15 +13:00
Olly Betts 631b41ae7b Use https for swig.org links 2022-10-06 13:16:39 +13:00
William S Fulton 77b08daca7 Add DohSortedKeys function
Returns a list of sorted keys in a DOH Hash.
2022-09-30 22:48:04 +01:00
William S Fulton 15b2ec53e3 Runtime tables deterministic ordering (4)
Output C/C++ type strings (| separated) in swig_type_info tables in
fixed order. The types are output in alphabetically sorted order,
with an exception. The final type is a fully resolved type, but
does not necessarily include default template parameters.
This type is the one used by SWIG_TypePrettyName which is commonly
used to display a type when the wrong type is passed in as a
parameter.

Previously the order was not very deterministic due to the use of
internal hash tables which do not have an ordering guarantee.
2022-09-29 19:40:47 +01:00
William S Fulton 5fdb591a62 Runtime tables deterministic ordering (3)
Output conversion functions used in the type tables in sorted order.
Sorted order in this case is the type being converted from.
So _p_BarTo_p_Foo comes before _p_ZarTo_p_Foo.

Previously the order was roughly in the order that the types were
parsed, but not necessarily due to the use of internal hash tables
which do not have an ordering guarantee.
2022-09-29 19:30:20 +01:00
William S Fulton 04af102578 Runtime tables deterministic ordering (2)
Output conversion functions used in the type tables in sorted order.
Sorted order in this case is the type being converted to.
So _p_BarTo_p_Foo comes before _p_BarTo_p_Zoo.

Previously the order was roughly in the order that the types were
parsed, but not necessarily due to the use of internal hash tables
which do not have an ordering guarantee.
2022-09-29 19:30:20 +01:00
William S Fulton acbe8ed49c Runtime tables deterministic ordering (1)
Many parts of the runtime tables are alphabetically sorted before
for the generated code. This patch sorts the elements within the
swig_cast_info lists. Order now is first the elements without a
converter then the elements with a converter.
For example:

new:
static swig_cast_info _swigc__p_Foo[] = {
  {&_swigt__p_Foo, 0, 0, 0},
  {&_swigt__p_Bar, _p_BarTo_p_Foo, 0, 0},
  {&_swigt__p_Spam, _p_SpamTo_p_Foo, 0, 0},
  {0, 0, 0, 0}};

old:
static swig_cast_info _swigc__p_Foo[] = {
  {&_swigt__p_Bar, _p_BarTo_p_Foo, 0, 0},
  {&_swigt__p_Foo, 0, 0, 0},
  {&_swigt__p_Spam, _p_SpamTo_p_Foo, 0, 0},
  {0, 0, 0, 0}};

Previously the order was roughly in the order that the types were
parsed, but not necessarily due to the use of internal hash tables
which do not have an ordering guarantee.
2022-09-29 19:30:20 +01:00
Vadim Zeitlin b9fa8c23bb Make method wrappers suffix optional and disabled by default
Unfortunately the changes of 26bf86322 (Use SWIG-specific for
non-overloaded synthesized functions too, 2021-11-09) did break some
existing code bases using SWIG as they hardcoded the old wrapper
function names.

So turn this off by default and add a global variable allowing to enable
this, which can be done for a specific language only. This is ugly but,
unfortunately, there is no way to use the Language object from the C
function Swig_MethodToFunction(), so the only alternative would be to
add another parameter to it, but it already has 6 of them, so it
wouldn't really be that much better.

See #2366, #2368, #2370.
2022-09-19 12:40:03 +12:00
Vadim Zeitlin 864f32159a Merge branch 'restore-compat-wrappers-names' into C
Merge with the latest master including PR #2371.
2022-09-17 14:36:37 +02:00
Vadim Zeitlin 3caf285742 Make method wrappers suffix optional and disabled by default
Unfortunately the changes of 26bf86322 (Use SWIG-specific for
non-overloaded synthesized functions too, 2021-11-09) did break some
existing code bases using SWIG as they hardcoded the old wrapper
function names.

So turn this off by default and add a global variable allowing to enable
this, which can be done for a specific language only. This is ugly but,
unfortunately, there is no way to use the Language object from the C
function Swig_MethodToFunction(), so the only alternative would be to
add another parameter to it, but it already has 6 of them, so it
wouldn't really be that much better.

See #2366, #2368, #2370.
2022-09-17 14:27:51 +02:00
William S Fulton 3fa8e1f38f Visual C++ warning fix
conversion from '__int64' to 'long', possible loss of data
2022-07-31 01:02:08 +01: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 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 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 6b4d5fe3f0 Remove remaining code to support macos9
This OS has been unsupported for over 20 years.  We stopped providing
macswig builds more than 20 years ago too:

https://sourceforge.net/projects/swig/files/macswig/

The required SIOUX library doesn't seem to be available anywhere
now either.

Closes #2323
2022-07-19 11:22:37 +12:00
Olly Betts 892557e799 Improve #include guard macros
Avoid using reserved identifiers such as `_DOHINT_H` (fixes #1989),
fix cases where the name doesn't match the filename, and make the naming
more consistent and less likely to collide with include guards in other
headers.
2022-07-19 09:35:46 +12:00
William S Fulton ea193a98f3 Merge two commits from movable-types-inputs
Performance optimisation for parameters passed by value that are C++11 movable.
  Test copy constructor and assignment operator calls for movable types

Conflicts:
	CHANGES.current
2022-07-12 09:48:17 +01:00
William S Fulton e777b054d5 Performance optimisation for parameters passed by value that are C++11 movable.
The C++ wrappers create a temporary variable for a parameter to be passed to a
function. This is initially default constructed and then copy assigned from the
instance being passed in from the target language. This is unchanged, however,
when the temporary variable is passed to wrapped function, it is now done using
std::move. If the type is move constructible, the move constructor will be used
instead of the copy constructor.

Note that the implementation calls std::move for all user-defined types
(non-primitive types passed by value), this excludes anything passed by pointer,
reference and arrays. It does also include any type that has not been
defined/parsed by SWIG, that is, unknown types. std::move is called via the
SWIG_STD_MOVE macro which only calls std::move for C++11 and later code.
2022-07-08 17:41:15 +01:00
Julien Marrec d3759a9b36 Avoid parse errors for C++ attributes
Just ignore anything in between [[ and ]] in the scanner, which is better
that failing with a parse error.

Fixes #1158
Fixes #2286
2022-07-08 15:27:02 +12:00
Olly Betts 6c4010e442 Resolve -Wstrict-prototypes warnings with clang-15
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
2022-06-30 12:52:00 +12:00
Seth R Johnson 6254de05ef Avoid emitting locals duiring keyword typemap lookup 2022-06-04 14:19:15 +01:00
Seth R Johnson 5afc813842 Fix whitespace and memory leak 2022-06-04 13:55:24 +01:00
William S Fulton da40946aaa Merge branch 'typemap-colon'
* typemap-colon:
  Incoporate review suggestions
  Allow referencing of typemap keywords inside of "$typemap("
2022-06-01 07:57:01 +01:00
William S Fulton 2ded25d138 Fixes for ISO C89 2022-03-28 19:25:11 +01:00
William S Fulton 51a7f27d1c Minor fix to Swig_print_node 2022-03-25 23:44:07 +00:00
William S Fulton 1db04bf322 Improvements to the -debug command line options
The debug command line options that display parse tree nodes
(-debug-module, -debug-top, -debug-symtabs) now display previously hidden
linked list pointers which are useful for debugging parse trees.

Added new command line option -debug-quiet. This suppresses the display
of most linked list pointers and symbol table pointers in the parse tree nodes.

The keys in the parse tree node are now shown in alphabetical order.
2022-03-25 23:34:52 +00:00
Olly Betts b2c58115d7 Fix previous commit
Revert changes inadvertently included, and fix `=` to `==`.
2022-03-20 19:44:23 +13:00
Olly Betts 029ddab8b5 [ci] Try to fix failing appveyor python builds 2022-03-20 18:42:50 +13:00
Olly Betts d7e83c1cbc Fix checking of "optimal" typemap attribute
Previously SWIG checked that the typemap action contained ";\n" not
followed by an identifier character, and that it contained no other
`;`, but that incorrectly allows some cases it shouldn't.

Instead check that the action ends with `;\n` and contains no other
`;`, which is simpler and correctly rejects these cases.
2022-03-19 08:13:09 +13:00
Olly Betts d7625ee6b2 Fix fatal error implemented by assert
Calling assert() on a condition that's always false is not an
appropriate way to exit after emitting "Fatal error [...]" because
if NDEBUG is defined the assert() becomes a no-op and the error
stops actually being fatal.
2022-03-07 14:24:48 +13:00
Olly Betts 735732d721 Eliminate calls to abort()
Call Exit(EXIT_FAILURE) instead so that output files get removed.
2022-03-06 14:21:06 +13:00
Olly Betts 55377bdc08 Add DOH Exit() and SetExitHandler()
Exit() is a wrapper for exit() by default, but SetExitHandler() allows
specifying a function to call instead.

This means that failures within DOH (e.g. Malloc() failing due to lack
of memory) will now perform cleanup such as removing output files.

This commit also cleans up exit statuses so SWIG should now reliably
exit with status 0 if the run was successful and status 1 if there was
an error (or a warning and -Werror was in effect).

Previously in some situations SWIG would try to exit with the status set
to the number of errors encountered, but that's problematic - for
example if there were 256 errors this would result in exit status 0 on
most platforms.  Also some error statuses have special meanings e.g.
those defined by <sysexits.h>.

Also SWIG/Javascript tried to exit with status -1 in a few places (which
typically results in exit status 255).
2022-03-06 12:33:54 +13:00
Olly Betts e38847f7e1 Fail cleanly on allocation failures
Previously code in the SWIG tool didn't handle allocation failures
well.  Most places didn't check for NULL return from
malloc()/realloc()/calloc() at all, typically resulting in undefined
behaviour, and some places used assert() to check for a NULL return
(which is a misuse of assert() and such checks disappear if built with
NDEBUG defined leaving us back with undefined behaviour).

All C allocations are now done via wrapper functions (Malloc(),
Realloc() and Calloc()) which emit and error and exit with non-zero
status on failure, so a non-NULL return can be relied upon.

Fixes #1901.
2022-03-04 11:47:49 +13:00
Olly Betts deb7cbf741
Merge branch 'master' into director-unwrap-result 2022-03-01 11:34:59 +13:00
Seth R Johnson b38a6530e3 Incoporate review suggestions 2022-02-26 06:40:37 -05:00
Seth R Johnson 1329670640 Allow referencing of typemap keywords inside of "$typemap(" 2022-02-25 10:52:33 -05:00
William S Fulton d2e9b80be3 Merge branch 'using-declarations' into upstream-master
* using-declarations:
  Typo fixes
  Fix warning suppression for WARN_PARSE_USING_UNDEF
  Using declarations fix in symbol tables
  Revert recent using-declarations code changes

Conflicts:
	CHANGES.current
2022-02-20 17:04:56 +00:00
William S Fulton 9b131a03d5 Fix warning suppression for WARN_PARSE_USING_UNDEF
New warnings for unknown using declarations since fix in previous commit
2022-02-20 16:45:10 +00:00
William S Fulton cb963a1440 Using declarations fix in symbol tables
Implementation is very similar to typedef implementation.
Issue #655 and closes #1488.
Testcase using_member.i.
Better implementation to that reverted in previous commit 3f36157b.
Symbol tables shown with -debug-csymbols and -debug-symbols now correct
and are similar to when using a typedef.
2022-02-20 15:33:32 +00:00
William S Fulton 3f36157b39 Revert recent using-declarations code changes
Reverts code changes from 7b5a615e50
merge commit in preparation for better fix.
Issue #655 and issue #1488.
2022-02-20 11:12:16 +00:00
Olly Betts 89a0a3c5f7
Merge pull request #2197 from swig-fortran/rename-warn
Print rename warnings except anonymous template methods
2022-02-10 16:15:10 +13:00
Dimitris Apostolou 40c3bf30b2 Fix typos 2022-02-10 16:12:24 +13:00
Seth R Johnson a81a9452a8 Revert "Enable 'regextarget' option for '%namewarn'"
This reverts commit d7e0aaa57d. I can't
get regextarget to work correctly, and the fortran branch no longer
depends on it since pcre support is optional.
2022-02-09 18:11:12 -05:00
William S Fulton a5315e1159 gcc warning fix
warning: control reaches end of non-void function [-Wreturn-type]
2022-02-07 21:50:13 +00:00
William S Fulton 013be550ed Merge branch 'fragment-typemap' into upstream-master
* fragment-typemap:
  Add documentation
  Enable multiple 'fragment' keywords to be attached to typemaps
2022-02-07 20:35:08 +00:00
Olly Betts 467c530e65 Remove support for the "command" encoder
The "command" encoder was mostly intended for use in `%rename` - most
uses can be achieved using the "regex" encoder, so we recommend using
that instead.

The "command" encoder suffers from a number of issues - as the
documentation for it admitted, "[it] is extremely slow compared to all
the other [encoders] as it involves spawning a separate process and
using it for many declarations is not recommended" and that it "should
generally be avoided because of performance considerations".

But it's also not portable.  The design assumes that `/bin/sh` supports
`<<<` but that's a bash-specific feature so it doesn't work on platforms
where `/bin/sh` is not bash - it fails on Debian, Ubuntu and probably
some other Linux distros, plus most non-Linux platforms.  Microsoft
Windows doesn't even have a /bin/sh as standard.

Finally, no escaping of the passed string is done, so it has potential
security issues (though at least with %rename the input is limited to
valid C/C++ symbol names).

Fixes #1806
2022-02-07 09:47:01 +13:00
Seth R Johnson 018254cca3 Reformat name warnings to reduce changes 2022-02-06 13:51:37 -05:00
Seth R Johnson de78b80de9 Renames performed by `%namewarn` with `rename=` are printed in warning message
This is necessary for regex-like renames (where you can't use the #define trick
as is done in many of the %keywordwarn directives). It's now unnecessary to print
the "renaming to '`x`'" code explicitly by the kw.swg files.
2022-02-06 13:51:37 -05:00
Seth R Johnson d7e0aaa57d Enable 'regextarget' option for '%namewarn'
This enables auto-renaming of identifiers beginning with '_', necessary
for Fortran.
2022-02-06 13:51:37 -05:00
Seth R Johnson 325056453a Enable multiple 'fragment' keywords to be attached to typemaps
This is consistent with the use of `%fragment`. Previously only the last
`fragment=` keyword would be added.
2022-02-05 19:03:43 -05:00
Olly Betts d9ced1e56d Coding style tweaks 2022-01-30 10:55:00 +13:00
Frank Schlimbach 4ce2964ab8 adding support for structs, docu 2022-01-30 10:55:00 +13:00
Frank Schlimbach 63452e9fc1 better handling of using directives 2022-01-30 10:55:00 +13:00
Olly Betts 98e1251772 Handle ellipsis as a token in the scanner
This is more correct (previously SWIG incorrectly accepted 3 periods
with whitespace between as an ellipsis) and helps avoid conflicts in
the grammar.
2022-01-26 12:31:52 +13:00
William S Fulton f8e4a5cc25 Few more PCRE to PCRE2 changes 2022-01-21 18:35:20 +00:00
Julien Schueller 15515f390c PCRE2
Closes #2120
2022-01-21 07:46:08 +01:00
William S Fulton 3200a815d4
Merge pull request #2095 from vadz/extend-suffix
Use suffix for static methods added by %extend
2022-01-08 21:11:14 +00:00
Olly Betts 4467c94fe9 Fix removeNode() to really unset previousSibling
There was a typo in attribute name so we attempted to remove the
non-existent attribute prevSibling instead.
2021-12-10 18:34:21 +13:00
Vadim Zeitlin c3b262c2f7 Merge branch 'master' into C
Merge with the latest master to resolve (trivial) conflict in the
GitHub workflow file.
2021-11-27 00:20:19 +01:00
Dimitris Apostolou f586d920f7
Fix typos 2021-11-17 07:07:02 +02:00
Vadim Zeitlin 8594a8def6 Use SWIG-specific suffix for non-overloaded %extend functions too
This avoids conflicts between functions synthesized by %extend when
adding static methods to an existing class, and the actual wrapper
functions generated by the backend.

This shouldn't result in any user-visible changes.
2021-11-10 00:53:39 +01:00
Vadim Zeitlin 5bf1497d7b Allow customizing type mangling in SWIG preprocessor
Use the "type" naming format for the types mangled by "#@" and "##@"
preprocessor operators, in order to allow customizing them for a
particular backend.

This isn't used by any backend yet, so this doesn't change anything so
far.
2021-11-10 00:53:39 +01:00
Vadim Zeitlin 26bf86322b Use SWIG-specific for non-overloaded synthesized functions too
This avoids conflicts between such functions, which are generated when
using %extend to add static methods to an existing class, and the actual
wrapper functions generated by the backend.

This shouldn't result in any user-visible changes.
2021-11-09 23:35:30 +01:00
Olly Betts 20fd344e86 Fix comment typo 2021-05-05 16:01:51 +12:00
William S Fulton b3bc87d551 template template parameters patch tidyup
- Document change in CHANGES file
- Minor tweaks and whitespace fixes in stype.c
- Enhance testcase
- Synchronise Java and Python runt test in testcase
2021-03-22 01:08:05 +00:00
William S Fulton cbfc0d15b1 Fix handling of Template template parameters
Closes #1977
Fixes #1603

Squashed commit of the following:

commit 61f794184e
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:20:25 2021 +0100

    added python version for second part of testcase

commit bb80e236b8
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:10:14 2021 +0100

    reworked comment in fixed code

commit 5a94bcc481
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:07:34 2021 +0100

    removed new unittests; I switched to the official test cases

commit 36603f3c8d
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:05:33 2021 +0100

    removed new unittests; I switched to the official test cases

commit 1f20ea00d2
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 14:39:19 2021 +0100

    adapted testcase

commit ab492794c0
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 14:29:10 2021 +0100

    fixed test

commit 9b5dd0c8f9
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 13:04:06 2021 +0100

    C99 compatible comments

commit 1a89425ac8
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 11:41:48 2021 +0100

    added extra checks to prevent accidental partial matches

commit 20e76f511a
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:42:56 2021 +0100

    minor

commit 0e383bbb76
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:41:45 2021 +0100

    cleanup

commit b644767121
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:39:43 2021 +0100

    cleanup

commit 2574468c0f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:38:35 2021 +0100

    cleanup

commit 9dc7f1ed30
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:35:28 2021 +0100

    removed ide files

commit a442a9df46
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:32:36 2021 +0100

    removed printf

commit da4c6e91e3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:29:02 2021 +0100

    possible fix found

commit 6fad8d40e3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:01:11 2021 +0100

    found difference between good/bad case... next: analyze why replacement did not work here...

commit 72a7693340
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:43:08 2021 +0100

    ideintified location where the template-template type is inserted in the final type (with the missing specialization).

commit 1b53312c07
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:28:19 2021 +0100

    more notes (to be reverted)

commit a9a0b58938
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:19:16 2021 +0100

    some experiments (to be reverted)

commit 0e7a24bbd5
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 21:46:20 2021 +0100

    added some notes

commit 2f77911a12
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 22:01:01 2021 +0100

    comment changed

commit 2cb7213b06
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 21:55:47 2021 +0100

    renamed example template parameters to easily distinguish them.

commit ff457d7397
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 21:21:10 2021 +0100

    added reset parser functionality (required for unittests, to reset parser)

commit 617bbde3b4
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 20:47:41 2021 +0100

    adjusted test for simple templates

commit beb7e7f77c
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Mon Mar 15 07:41:17 2021 +0100

    added note how it should be...

commit 7b3328431c
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 17:07:24 2021 +0100

    found a place which is maybe problematic for the template_template problem (#1603)

commit 46c2443d15
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 16:11:56 2021 +0100

    unitests: reset parser for each testcase

commit b3a0f1516f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 15:30:47 2021 +0100

    first experiment with templates

commit 32a11c6c77
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:31:17 2021 +0100

    wip

commit 37b805ba6e
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:21:05 2021 +0100

    integrated unittests in ctest

commit 79f7bee168
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:18:26 2021 +0100

    wip: new test created; problem: not in c++ mode

commit 345d503d55
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:08:09 2021 +0100

    cleanup test code

commit 0a26adec10
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:05:24 2021 +0100

    some more tests (first steps with c++ code)

commit 6f628e0fa9
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 12:56:41 2021 +0100

    experiments

commit c4a13bf3e1
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 13 18:18:01 2021 +0100

    first experiment

commit 7d26586105
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 13 17:23:13 2021 +0100

    setup catch2 framework (w/o tests)
2021-03-22 01:02:42 +00:00
Michel Zou ee8d47cec4 Fix few unused variable warnings 2021-03-07 11:20:31 +00:00
William S Fulton 638ca8152d complex can now be used as an identifier
Remove final vestiges of 'complex' keyword.

Closes #252
2020-10-10 16:07:55 +01:00
William S Fulton 4f184500d7 Merge commit '8245277ad3acd9308ce28c40508b999e9496b27e' into c99-complex
* commit '8245277ad3acd9308ce28c40508b999e9496b27e':
  Remove test for unsupported complex or _Complex by itself
  More C99 complex fixes, plus Python tests
  Restore _Complex as standalone type
  Small corrections for handling C99 _Complex
  Properly handle C99 complex types even in C++ mode

Conflicts:
	Examples/test-suite/python/complextest_runme.py
2020-10-10 14:53:33 +01:00
Alistair Delva baf2fbb98f naming: Add unreachable return to !HAVE_PCRE path
Android builds all host tools with -Werror=no-return, which generates a
false positive in name_regexmatch_value() if HAVE_PCRE is not present.

Fix this by adding a return code to the !HAVE_PCRE path. This return
will not be reached but will suppress the compiler warning.

If/when SWIG can require C++11 compilers, a better fix would be to make
SWIG_exit() [[noreturn]].

Closes #1860
2020-08-13 09:19:37 -07:00
Leo Singer 07b4b274e5 Restore _Complex as standalone type 2020-06-24 20:21:47 -04:00
Leo Singer 1adc7dac5d Small corrections for handling C99 _Complex 2020-06-24 20:21:47 -04:00
Leo Singer 13260f95b0 Properly handle C99 complex types even in C++ mode
Use the `_Complex` keyword rather than the `complex` macro.

Fixes #1487.
2020-06-24 20:21:47 -04:00
Thomas Reitmayr 01277d700c Unwrap director classes only when returning a pointer or reference to an object
This involves properly counting the number of references and pointers in the return
type of a function and only generate unwrapping code if this number is 1.
For template instances some post-processing code is added to fix the 'decl' and
'type' attributes of functions if changed in an unfavorable way during template
expansion.
This commit fixes swig#1811.
2020-06-20 12:17:55 +02:00
Noah Stegmaier 3cc4d76e23 escape filepaths 2020-06-04 12:10:24 +02:00
William S Fulton 2cf075558c Replace all exit() with SWIG_exit()
For consistent cleanup on error
2019-07-31 00:08:49 +01:00
William S Fulton 195226873e Merge branch 'ZackerySpytz-valid-floating-point-literals'
* ZackerySpytz-valid-floating-point-literals:
  Fix some rejections of valid floating-point literals
2019-03-02 17:48:49 +00:00
William S Fulton 83ea2280e2 Fix Python compile errors with overloading and varargs
Fixes wrapping overloaded functions/constructors where a vararg
function is declared after a non-vararg function.
This is a long standing bug in the Python layer exposed since fastunpack
was turned on by default.
2019-02-25 19:27:23 +00:00
Zackery Spytz 1c03af9b96 Fix some rejections of valid floating-point literals
Some valid floating-point literals were giving
"Error: Syntax error in input(1)".
2019-02-21 02:11:51 -07:00
William S Fulton 024eaeaacf Improve debug display of parameters
Debug display now displays parameters as strings for "kwargs", "pattern",
"templateparms", "throw" elements in the parse tree (not just "parms"
and "wrap:parms").
Add in single quotes when displaying these parameter lists as strings.
2019-02-17 20:03:23 +00:00
William S Fulton 629c881de5 Template instantion fixes when template parameter is used twice in type
For example T in:
Y<T>::YYY<T>::value_type
2019-02-17 20:03:18 +00:00
William S Fulton de861bea64 Memory leak fixes calling Swig_scopename_split 2019-02-16 13:06:43 +00:00
Zackery Spytz cf83adfcd1 Add support for C++17 hexadecimal floating literals 2019-02-13 15:16:40 -07:00
William S Fulton be84fc62a9 Merge branch 'ZackerySpytz-cpp14-binary-integer-literals'
* ZackerySpytz-cpp14-binary-integer-literals:
  Add support for C++14 binary integer literals
2019-02-11 18:36:47 +00:00
Vadim Zeitlin ddf4bbe112 Merge branch 'fix-ignore-param'
Fix for wrongly renaming parameters to "$ignore" in Python.

See https://github.com/swig/swig/pull/1462
2019-02-11 14:24:46 +01:00
Zackery Spytz 23d83cd9c1 Add support for C++14 binary integer literals
Closes #1030.
2019-02-10 15:38:49 -07:00
Zackery Spytz 8bf40596b8 C++17 u8 character literals fix 2019-02-10 16:06:53 +00:00
Vadim Zeitlin 2517f5b05e Don't apply %ignore to parameters
Fix regression introduced by 3f5c17824c
which resulted in using "$ignore" instead of the real parameter name in
Python if an %ignore/%rename($ignore) for the parameter name was used
(as could happen not necessarily intentionally when using wild card
ignores with regex matches) by explicitly checking if we're dealing with
a parameter node in apply_rename(), used by Swig_name_make(), and not
renaming it to "$ignore" in this case.

Extend the test suite to check for this case.

Closes #1460.
2019-02-10 13:40:12 +01:00
Zackery Spytz 8c2cb4e604 Add support for the C++11 u and U encoding prefixes for char literals
"u" and "U" are new in C11 and C++11 for char literals.
2019-02-05 15:08:35 -07:00
William S Fulton 1329ed7a5c Suppress rename warnings when parameter names are keywords
Parameter renaming is not fully implemented. Mainly because there is no
C/C++ syntax to
for %rename to fully qualify a function's parameter name from outside
the function. Hence it
is not possible to implemented targetted warning suppression on one
parameter in one function.

Issue #1420
2019-01-19 19:52:34 +00:00
William S Fulton a4e48b18e5 Merge branch 'baldurk-raw-strings-issue-948'
* baldurk-raw-strings-issue-948:
  Experimental fix for delimiter leakage in raw strings.
2019-01-04 19:32:45 +00:00
William S Fulton 33921666a1 Merge branch 'vadz-doxygen'
This is the Doxygen work begun in Google Summer of Code projects 2008
and 2012 and subsequently improved by numerous contributors.

* vadz-doxygen: (314 commits)
  Add changes entry for Doxygen support
  Add some missing doctype tyemaps
  Doxygen warnings cleanup
  Move doxygen warning numbers
  Add Python doxygen example
  Doxygen example
  Add Doxygen to include paths
  Doxygen source rename
  More merge fixes from doxygen branches
  Correct python example headers
  Correct source code headers
  Another merge fix from doxygen branches
  Java enums output format fixes
  Add omitted doxygen_parsing_enums testcase
  PEP8 conformance for comment verifier module
  Clean up merge problem
  Doxygen html tweaks
  Update html chapter numbering for added Doxygen chapter
  Fixes to makechap.py to detect ill-formed headers
  html fixes for Doxygen
  Add missing CPlusPlus17.html file
  Format files to unix format
  Doxygen testcase tweak to match that in the html docs
  Doxygen html documentation updates and corrections
  Remove doxygen Examples subdirectory
  Beautify doxygen source code
  Code formatting fixes in doxygen code
  Remove unused doxygen code
  new_node refactor
  Various merge fixes in doxygen branches
  Unused variable warning fix
  Fix wrongly resetting indent after formulae in Doxygen comments
  Add support for doxygen:alias feature
  Get rid of meaningless return type of DoxygenParser methods
  Return enum, not untyped int, when classifying Doxygen commands
  Get rid of unnecessary "typedef enum" in C++ code
  Use slash, not backslash, in "C/C++" in the documentation
  Replace literal "<" with "&lt;" in HTML documentation
  Fix broken link to java.sun.com in Doxygen documentation
  Fix using com.sun.tools.javadoc package under macOS
  Fix error reporting for special characters in Doxygen parsing code
  Switch Python Doxygen unit tests to use inspect.getdoc()
  Use correct separator in Java class path under Windows.
  Remove executable permission from appveyor.yml.
  Use JAVA_HOME value in configure to detect Java.
  Display JAVA_HOME value in "make java_version".
  Fix harmless MSVC warning in DoxygenTranslator code.
  Reset "_last" for all but first enum elements.
  Don't duplicate Javadoc from global enum Doxygen comments twice.
  Move Doxygen comments concatenation from the parser to the lexer.
  Fix shift/reduce conflicts in Doxygen pre/post comment parsing.
  Rewrote part of the grammar dealing with Doxygen comments for enums.
  No changes, just remove spurious white space only differences.
  Move Doxygen comment mangling from the parser to the lexer.
  Merge "-builtin" autodoc bugs workarounds from master into test.
  Quote JAVA_HOME variable value in Java test suite makefile.
  Remove unused C_COMMENT_STRING terminal from the grammar.
  Fix missing returns in the Doxygen test suite code.
  Fix trimming whitespace from Doxygen comments.
  Remove code not doing anything from PyDocConverter.
  Remove unused <sstream> header.
  Remove unreferenced struct declaration.
  Remove unused Swig_warn() function.
  Remove any whitespace before ignored Doxygen commands.
  Remove trailing space from one of Doxygen tests.
  Fix autodoc strings generated in Python builtin case and the test.
  Fix Doxygen unit test in Python "-builtin" case.
  Use class docstrings in "-builtin" Python case.
  Don't indent Doxygen doc strings in generated Python code.
  Add a possibility to flexibly ignore custom Doxygen tags.
  Stop completely ignoring many Doxygen comments.
  Fix structural Doxygen comment recognition in the parser.
  No changes, just make checking for Doxygen structural tags more sane.
  Use "//", not "#", for comments in SWIG input.
  Allow upper case letters and digits in Doxygen words.
  Pass the node the Doxygen comment is attached to to DoxygenParser.
  Get rid of findCommand() which duplicaed commandBelongs().
  Recognize unknown Doxygen tags correctly.
  No real changes, just pass original command to commandBelongs().
  Describe Doxygen-specific %features in a single place.
  Give warnings for unknown Doxygen commands in Doxygen parser.
  Document the return type when translating Doxygen @return to Python.
  Fix translated Doxygen comments for overloaded functions in Python.
  Also merge Doxygen comments for overloaded constructors in Python.
  Allow using enum elements as default values for Python functions.
  Don't always use "*args" for all Python wrapper functions.
  No real changes, just make PYTHON::check_kwargs() const.
  Refactor: move makeParameterName() to common Language base class.
  Remove long line wrapping from Python parameter list generation code.
  Simplify and make more efficient building Python docstrings.
  Translate Doxygen code blocks to Sphinx code blocks.
  Add a simple test of multiple parameters to Doxygen test suite.
  Make Python parameters types hyperlinks in the doc strings.
  Make Language::classLookup() and enumLookup() static.
  Fix arguments of @param, @return etc translations to Python.
  Remove unused method from PyDocConverter.
  No real changes, just remove an unnecessary variable.
  Preserve relative indentation when parsing Doxygen comments.
  Use Sphinx-friendly formatting for overloaded functions documentation.
  Add poor man trailing white space detection to Doxygen Python tests.
  ...
2018-06-07 08:13:10 +01:00
William S Fulton 9deaa6ff24 new_node refactor
Reduce code duplication for doxygen to match code in master prior to
merge to master
2018-05-19 09:00:06 +01:00
luz.paz 60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
Vadim Zeitlin b7f78dd5a7 Merge branch 'master' into doxygen 2018-03-19 21:54:46 +01:00
William S Fulton 07a30249f4 Fix seg fault parsing invalid exponents
Add error message when exponents are incomplete,
for example 5e and 5.e
2018-01-14 19:36:09 +00:00
William S Fulton 7d6808daab Small code simplification using SwigValueWrapper
Closes #1139
2017-11-03 07:11:12 +00:00
William S Fulton 8834047dcd Enhance -debug-csymbols and -debug-symbols to show siblings 2017-10-02 19:07:24 +01:00
William S Fulton e27a606335 Allow an instantiated template to have the same name as the C++ template name
For example, this is now possible:
  template<typename T> struct X { ... };
  %template(X) X<int>;
Closes #1100.
2017-09-29 23:28:04 +01:00
William S Fulton 9e79d3566b Workaround spurious gcc warning [-Woverlength]
warning: string length ‘2241’ is greater than the length ‘509’ ISO C90 compilers are required to support [-Woverlength-strings]
2017-09-20 14:04:16 +01:00
Vadim Zeitlin db65ae5aea Merge branch 'master' into doxygen
Fix the usual conflicts in autodoc unit test due to fixing the
divergences in autodoc generation between builtin and default cases in
this branch.
2017-09-19 14:02:53 +02:00
William S Fulton 45c161dfce Fix wrapping of some member function pointer parameters
Generated code did not compile if both cv-qualifiers and rvalue
ref-qualifiers were present in the member function pointer.
2017-09-07 06:58:01 +01:00
William S Fulton eb68e4375d Add support for member function pointers with ref-qualifiers 2017-09-05 18:44:00 +01:00
William S Fulton 8a40327aa8 Add unignore for rvalue ref-qualifiers
Use std::move on this pointer as the default approach to supporting
rvalue ref-qualifiers if a user really wants to wrap.

std::move requires <memory> headers so add swigfragments.swg for all
languages to use common fragments. Just header file fragments for now.
2017-08-30 18:17:04 +01:00
William S Fulton 1cf599bccb Improve ref-qualifier implementation
Internally, handle function ref-qualifiers in the function decl type string.
Needed for a whole host of things to work like %feature and %rename.
Add %feature %rename and %ignore testing for ref-qualifiers.
2017-08-30 18:17:04 +01:00
William S Fulton eeab152901 Fix support for member const function pointer variables
Was not generating code that compiled when the variable was not
a simple member pointer, for example,
a const reference member pointer:
  short (Funcs::* const& cc7)(bool) const = cc1;
2017-08-30 18:16:59 +01:00
William S Fulton 685ee6cdc4 Use normal SWIG encodings for ref-qualifiers 2017-08-19 09:38:19 +01:00
William S Fulton 9e19fe7868 C++11 ref-qualifier support added
Fixes #1059

Methods with rvalue ref-qualifiers are ignored by default as it is not
possible to have an rvalue temporary from the target language (which is
needed to call the rvalue ref-qualified method).
A warning 405 is shown mentioning the ignored rvalue ref-qualifier method
which can be seen with the -Wextra option.

  cpp_refqualifier.i:15: Warning 405: Method with rvalue ref-qualifier ignored h() const &&.

Usually rvalue and lvalue ref-qualifier overloaded methods are written - the
lvalue method will then be wrapped.
2017-08-19 01:02:34 +01:00
William S Fulton 32a454cfef Merge branch 'templates-scope-enforcement'
* templates-scope-enforcement:
  Test a few %template errors
  Add using declarations to templates into typedef table.
  Fix type lookup in the presence of using directives and using declarations
  More docs on %template
  Testcase fix for nameclash in php
  %template scope enforcement and class definition fixes
  Template documentation tweaks
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  Documentation corrections to use targetlang formatting
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  Namespace documentation minor corrections
  Improve description of template_parameters_resolve
  Minor code optimisation in template_parameters_resolve
  Fix scope lookup for template parameters containing unary scope operators
  Typemap change for templates
2017-08-16 21:44:51 +01:00
William S Fulton 96e99416d7 Add using declarations to templates into typedef table.
Fixes #1051. Using declarations to templates were missing in SWIG's internal typedef tables.
This led to a few problems, such as, templates that did not instantiate and generated
C++ code that did not compile as SWIG did not know what scope the template was
in. This happened mostly when a using declaration was used on a template type in a
completely unrelated namespace.
2017-08-16 00:24:25 +01:00
William S Fulton bf98c5304f Fix type lookup in the presence of using directives and using declarations
Fix some cases of type lookup failure via a combination of both using directives and
using declarations resulting in C++ code that did not compile as the generated type was
not fully qualified for use in the global namespace. Example below:

    namespace Space5 {
      namespace SubSpace5 {
        namespace SubSubSpace5 {
          struct F {};
        }
      }
      using namespace SubSpace5;
      using SubSubSpace5::F;
      void func(SubSubSpace5::F f);
    }
2017-08-16 00:24:25 +01:00
William S Fulton 959e627208 %template scope enforcement and class definition fixes
The scoping rules around %template have been specified and enforced.
The %template directive for a class template is the equivalent to an
explicit instantiation of a C++ class template. The scope for a valid
%template instantiation is now the same as the scope required for a
valid explicit instantiation of a C++ template. A definition of the
template for the explicit instantiation must be in scope where the
instantiation is declared and must not be enclosed within a different
namespace.

For example, a few %template and explicit instantiations of std::vector
are shown below:

  // valid
  namespace std {
    %template(vin) vector<int>;
    template class vector<int>;
  }

  // valid
  using namespace std;
  %template(vin) vector<int>;
  template class vector<int>;

  // valid
  using std::vector;
  %template(vin) vector<int>;
  template class vector<int>;

  // ill-formed
  namespace unrelated {
    using std::vector;
    %template(vin) vector<int>;
    template class vector<int>;
  }

  // ill-formed
  namespace unrelated {
    using namespace std;
    %template(vin) vector<int>;
    template class vector<int>;
  }

  // ill-formed
  namespace unrelated {
    namespace std {
      %template(vin) vector<int>;
      template class vector<int>;
    }
  }

  // ill-formed
  namespace unrelated {
    %template(vin) std::vector<int>;
    template class std::vector<int>;
  }

When the scope is incorrect, an error now occurs such as:

cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and
was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.

Previously SWIG accepted the ill-formed examples above but this led to
numerous subtle template scope problems especially in the presence of
using declarations and using directives as well as with %feature and %typemap.

Actually, a valid instantiation is one which conforms to the C++03
standard as C++11 made a change to disallow using declarations and
using directives to find a template.

  // valid C++03, ill-formed C++11
  using std::vector;
  template class vector<int>;

Similar fixes for defining classes using forward class references have
also been put in place. For example:

namespace Space1 {
  struct A;
}
namespace Space2 {
  struct Space1::A {
    void x();
  }
}

will now error out with:

cpp_class_definition.i:5: Error: 'Space1::A' resolves to 'Space1::A' and
was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
2017-08-16 00:24:25 +01:00
William S Fulton 2681bbad36 Improve description of template_parameters_resolve 2017-08-16 00:24:24 +01:00
William S Fulton 8bf3a342c2 Minor code optimisation in template_parameters_resolve 2017-08-16 00:24:24 +01:00
William S Fulton 26e14c4f18 Fix scope lookup for template parameters containing unary scope operators
Fixes cases like:

namespace Alloc {
  template<typename T> struct Rebind {
    typedef int Integer;
  };
}
%template(RebindBucket) Alloc::Rebind< Bucket >;
OR
%template(RebindBucket) Alloc::Rebind< ::Bucket >;

Alloc::Rebind< Bucket >::Integer Bucket1() { return 1; }
Alloc::Rebind< ::Bucket >::Integer Bucket2() { return 2; }
Alloc::Rebind<::template TemplateBucket<double>>::Integer Bucket3() { return 3; };
2017-08-16 00:24:24 +01:00
William S Fulton aa2932f409 Typemap change for templates
For templates only, the template parameters are fully resolved when
handling typemaps. Without this, it is too hard to have decent rules
to apply typemaps when parameter types are typedef'd and template
parameters have default values.

Fixes %clear for typedefs in templates, eg:

  %typemap("in") XXX<int>::Long "..."
  template typename<T> struct XXX {
    typedef long Long;
  };
  %clear XXX<int>::Long;

as the typemap was previously incorrectly stored as a typemap for long
instead of XXX<int>::Long.
2017-08-16 00:24:06 +01:00
Olly Betts 90f9117e10 Fix various comment and documentation typos 2017-08-13 18:04:33 +12:00
baldurk 0eba02f37a Experimental fix for delimiter leakage in raw strings. 2017-07-06 17:40:44 +01:00
William S Fulton 11aa71b939 Make sure warning and error messages are not split up
They could be split up by other processes writing to stdout
at the same time.
2017-06-16 19:24:48 +01:00
William S Fulton 72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
William S Fulton 4f235027f4 Improved member function pointer parsing
Add support for parsing member function pointers with qualifiers,
references and pointers, eg

short (Funcs::* const parm)(bool)
2017-03-10 23:25:31 +00:00
William S Fulton 5aff26fcb5 Add support for parsing and wrapping member const function pointers 2017-03-10 23:25:31 +00:00
William S Fulton dee6b075a8 Fix seg fault parsing unterminated raw string literals 2017-02-09 22:02:20 +00:00
William S Fulton d387e749f5 Warning fix for visual c++ 2017-02-04 19:18:54 +00:00
William S Fulton 25ac8f97f6 Fix popen pclose warnings compiling under wine
Fix i686-w64-mingw32-g++ compiler on linux warning:

In file included from Swig/swig.h:21:0,
                 from Swig/misc.c:14:
Swig/misc.c:1125:14: warning: ‘_popen’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 extern FILE *popen(const char *command, const char *type);
              ^
Swig/misc.c:1126:12: warning: ‘_pclose’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 extern int pclose(FILE *stream);
2017-02-04 19:18:54 +00:00
Vadim Zeitlin 294ab27b90 Merge branch 'master' into doxygen
Merge 3.0.12 release changes from master.
2017-02-01 02:21:35 +01:00
William S Fulton 4c1152efcd Merge branch 'fschlimb-templ_def_cache'
* fschlimb-templ_def_cache:
  Add template_default_cache runtime tests
  Fix template_default_cache testcase
  template_default_cache is a multi-module test
  using 2-level caching as suggested by @wsfulton
  account for explicitly qualified scopes
  adding test
  restricting chaching template default types
2017-01-16 07:50:13 +00:00
William S Fulton 3d2e57b0f2 Add %proxycode directive for adding code into proxy classes for C#, D and Java 2017-01-13 20:43:50 +00:00
Frank Schlimbach be92482e27 using 2-level caching as suggested by @wsfulton 2017-01-09 09:46:33 -06:00
William S Fulton e6b270b6dc Suppress incorrect warning when a keyword is used in template classes
Closes https://github.com/swig/swig/issues/845
2016-12-20 19:44:57 +00:00
Vadim Zeitlin e668c47b70 Merge branch 'master' into doxygen
The way Python docstrings are indented has changed on master, so use the
standard inspect module in Python autodoc unit test to ignore the differences
in their indentation level between -builtin and non-builtin cases to make the
test still pass with the branch version, which avoids the use of different
(but almost identical) values in the test itself.
2016-12-12 01:24:17 +01:00
William S Fulton 7268f58c4c Fix %rename override of wildcard %rename for templates
%rename(GlobalIntOperator) *::operator bool; // wildcard %rename
%rename(XIntOperator) X::operator bool; // fix now overrides first %rename above
OR
%rename(XIntOperator) X<int>::operator bool; // fix now overrides first %rename above

template<typename T> struct X {
  operator bool();
  ...
};
%template(Xint) X<int>;
2016-11-28 22:50:52 +00:00
Frank Schlimbach 4eb7fb8123 account for explicitly qualified scopes 2016-10-11 07:05:44 -05:00
Frank Schlimbach 49cd031f12 restricting chaching template default types 2016-10-10 10:42:23 -05:00
Amarnath Valluri 030a3b08bf Fix leaked file descriptor
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2016-06-16 15:53:22 +03:00
Vadim Zeitlin 891565a3ca Refactor several Swig_name_xxx() functions into a single one
All Swig_name_{construct,copyconstructor,destroy,disown}() functions were
almost exactly identical, just replace them with a single make_full_name_for()
function to avoid code quadplication.
2016-04-11 16:50:41 +02:00
Vadim Zeitlin 3d7806bbe6 Refactor code accessing naming_hash
No real changes, but avoid repeating the same snippet of code, looking up
something in a hash and falling back to the default value if it's not present
there, in many places and use a simple wrapper get_naming_format_for()
function instead.

The wrapper function is also marginally more efficient than the old code as it
avoids creating the naming hash just to check if the key is in it -- we can be
pretty sure it isn't, if the hash hadn't existed before.
2016-04-11 16:39:44 +02:00
William S Fulton ac495d5c66 Merge branch 'char-escaping'
* char-escaping:
  Add missing string_constant.i testcase
  changes file update for char wrappers
  C# char wrappers fixes for enum values, static const member char values and %csconst
  D testing added for %dmanifestconst and char constants
  Fix wrapping D constants using %dmanifestconst
  Php fix for enum value of '\0'
  Fix static const char member variables wrappers with %javaconst(1).
  Expand char testing in enums and %constant
  Java char changes file update
  Java enum and static member variable escaping fix for chars
  Add tests for enum values and static const member variables chars containing escape sequences
  Minor documentation tweak

Conflicts:
	CHANGES.current
2016-03-12 23:27:51 +00:00
William S Fulton 5fb6537f69 C# char wrappers fixes for enum values, static const member char values and %csconst
Use hex escaping for char values used as C# constants
2016-03-12 18:52:49 +00:00
William S Fulton 4a3e1fd44c Add rstrip encoder for use in %rename.
This is like the strip encoder but strips the symbol's suffix instead
of the prefix.
2016-03-02 07:11:09 +00:00