Commit graph

548 commits

Author SHA1 Message Date
William S Fulton
fbed720b98 Merge branch 'enum-trailing-comma-doxygen'
* enum-trailing-comma-doxygen:
  Fix parsing of enums with trailing comma with -doxygen
2019-04-24 08:08:18 +01:00
Vadim Zeitlin
74adaa5738 Fix parsing of enums with trailing comma with -doxygen
To correctly parse Doxygen post-comments after the trailing comma,
switch to right recursion in "enumlist" production rule definition: this
does consume more stack space when parsing, but makes the rules much
easier to write and to understand and hopefully shouldn't result in any
problems with real code (which shouldn't have thousands of enums items
in it).

Closes #1514.
2019-04-20 13:52:56 +02:00
Vadim Zeitlin
01a2cd27e7 Don't crash if type is not available in Python Doxygen code
Fix crash if "@return" Doxygen tag was used on a node without any return
type (such as a class, for example). Ignoring it might not be the best
thing to do, but it's definitely better than crashing and it's not
really clear what else could be done anyhow.

Closes #1516.
2019-04-20 13:52:05 +02:00
William S Fulton
4e5d1891e6 testcase fixes for gcc-9 2019-04-15 23:25:53 +01:00
William S Fulton
be491506a4 Java std::vector improvements for types that do not have a default constructor.
The std::vector wrappers have been changed to work by default for elements that are
not default insertable, i.e. have no default constructor. This has been achieved by
not wrapping:

  vector(size_type n);

Previously the above had to be ignored via %ignore.

If the above constructor is still required it can be added back in again via %extend:

  %extend std::vector {
    vector(size_type count) { return new std::vector< T >(count); }
  }

Alternatively, the following wrapped constructor could be used as it provides near-enough
equivalent functionality:

  vector(jint count, const value_type& value);

The equivalent change to std::list has also been made (std::list
wrappers were not in the previous release [3.0.12] though).
2019-03-01 18:01:14 +00:00
William S Fulton
e6035d625a Java 9 deprecation warning fixes for test-suite and examples 2019-02-21 13:47:39 -08:00
William S Fulton
b9350614b5 Fix typemap matching to expand template parameters when the name contains template parameters.
In the %typemap below the type is T and the name is X<T>::make
which now expands correctly to X< int >::make

template<typename T> struct X {
  %typemap(out) T X<T>::make "..."
  T make();
};

%template(Xint) X<int>;
2019-02-17 21:38:48 +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
eb7b989c61 Fix parser error containing multiple #define statements inside an enum.
The second #define fails to parse:

  enum FooEnum {
    ENUM1 = 0,
    ENUM2 = 1,

  #define MACRO_DEF1 "Hello"
  #define MACRO_DEF2 "World!"

    ENUM3 = 2,
    ENUM4 = 3,
  };

Bug mentioned at https://sourceforge.net/p/swig/patches/333/
2019-02-16 08:09:56 +00:00
William S Fulton
1f44997343 rename std::array testcase 2019-02-13 22:46:20 +00:00
William S Fulton
136e6cfe2b Merge branch 'bkotzz-add_set_map'
* bkotzz-add_set_map:
  Add missing typedefs to Java STL containers
  Combine duplicate unordered_set unordered_map testcases
  Nicer looking generated Java container code
  Replicate some cosmetic changes from std_map.i
  Legacy macros, protected iterator, typedefs
  Remove c++11 from stl.i
  Add to STL file as well
  Maps both working as java.util impls
  Mostly working for map
  Add set/unordered_set that extend AbstractSet
  Move unordered containers under cpp11_ prefix
  Add test cases to C++11 list
  Add unordered_{set|map} and set to Java
2019-02-12 18:09:38 +00:00
William S Fulton
82d1632071 Combine duplicate unordered_set unordered_map testcases
Merge cpp11_li_std_unordered_map into cpp11_std_unordered_map
Merge cpp11_li_std_unordered_set into cpp11_std_unordered_set
2019-02-12 06:48:13 +00:00
William S Fulton
50a80e6ee3 Add a testcase for testing %native 2019-01-31 23:01:42 +00:00
William S Fulton
0c4491eaae Add more tests for C++11 raw string literals
Test added to check fixes for:

- Issue #948 and issue #1019 and issue #1273 - raw string delimiters
  not being stripped off
- Issue #538 - Ruby support for "docstring" feature
2019-01-06 00:10:01 +00:00
Brad Kotsopoulos
573ddb061e Maps both working as java.util impls 2018-12-27 01:11:54 -05:00
Brad Kotsopoulos
e6d8675513 Mostly working for map 2018-12-04 01:08:47 -05:00
Brad Kotsopoulos
6ccc940a14 Add set/unordered_set that extend AbstractSet 2018-11-30 18:21:02 -05:00
Brad Kotsopoulos
b1697d7772 Move unordered containers under cpp11_ prefix 2018-11-28 16:51:53 -05:00
Brad Kotsopoulos
4fe9406fae
Add test cases to C++11 list 2018-11-24 10:00:23 -05:00
Brad Kotsopoulos
0f18b430fb Add unordered_{set|map} and set to Java
Add test suite

Add to makefile

Revert set change

Fix java map test

Fix some of the tests

Fix unordered map test
2018-11-23 14:35:35 -05:00
William S Fulton
3195c3e4da Java directors - more generic thread name setting
Activated if a user sets SWIG_JAVA_USE_THREAD_NAME.
Implementations provided for linux/android/macos/unix.
A user's implementation will be used if SWIG_JAVA_GET_THREAD_NAME is
defined. It must implement the function:
  namespace Swig {
    SWIGINTERN int GetThreadName(char *name, size_t len);
  }
2018-10-08 21:38:41 +01:00
luz.paz
ed28e7cbe2 Misc. typo and whitespace fixes
Found via `codespell -q 3 -L "uint,bae,objext,cmo,goin,struc,ois,upto"`
whitespaces were unintentionally fixed due to my editors settings.

Rebased patch #1327
2018-09-19 20:29:14 +01:00
William S Fulton
61d9dd40a0 Fix crash Java directors
Further crash fixes when using OUTPUT and INOUT typemaps in typemaps.i and
passing NULL pointers in C++ to director method overloaded and implemented
in Java.

Don't create the one element array in these directorin typemaps if the
input is a NULL pointer, that is, translate a NULL C++ pointer into a
null Java object.

Also add some missing JNI error checks in these typemaps.
2018-08-12 13:45:43 +01:00
William S Fulton
99f8e12d32 Java director typemaps.i testing for pointers added
Copy java_director_typemaps testcase to test pointers instead of references.
2018-08-11 17:11:24 +01:00
William S Fulton
602b0d5a2c Add doxygen testing of Java constructor wrappers 2018-06-18 18:56:21 +01:00
William S Fulton
9cc05724ef Add java runtime test for nested classes 2018-06-18 18:55:14 +01:00
William S Fulton
ecc66fdcbd Add Doxygen test for constant and fix JavaDoc indentation 2018-06-17 00:17:07 +01:00
William S Fulton
d22ecafb36 Fix Java doxygen:notranslate for single line comments
Remove extra generated line
2018-06-16 21:23:12 +01:00
William S Fulton
cf3ff89433 Fix doxygen testing for jdk < 9 2018-06-11 23:40:58 +01:00
William S Fulton
a539d9e1e5 Remove some debugging in java Makefile 2018-06-09 00:49:56 +01:00
William S Fulton
b0a42e38e7 Revert "JAVA_HOME nad tools.jar not needed for Java testing"
This reverts commit 7373b99079.

Seems to be needed for older jdks - needs some more work, as the
classpath used is not correct for jdk9.
2018-06-09 00:40:26 +01:00
William S Fulton
7373b99079 JAVA_HOME nad tools.jar not needed for Java testing
tools.jar doesn't seem to be needed (in jdk9 anyway), so removing it.
2018-06-08 19:12:39 +01:00
William S Fulton
4e27fdbfc1 Fix java test-suite parallel build (doxygen test cases)
CommentParser.class was being generated and read from multiple threads
Compile it just once using make dependencies.
2018-06-08 08:40:07 +01:00
William S Fulton
cbaf6eb2b3 Clean up merge problem 2018-05-25 07:56:45 +01:00
William S Fulton
0cfd53cff7 Merge branch 'master' into vadz-doxygen
* master:
  Add Octave 4.4 to Travis allow_failures
  Fixes for appveyor image changes
  Javascript test-suite Makefile parallel jobs
  Add changes entry for csconstruct, dconstruct and javaconstruct fix
  Fix lookup of csconstruct, dconstructor and javaconstruct typemaps
  Javascript %nspace fix in generated C++ code
  Add C++17 documentation chapter
  Add changes notes for C++17 nested namespaces support
  Test for invalid C++17 nested namespace aliases
  Test c++17 nested namespaces and %nspace
  Add c++17 nested namespaces runtime test for C#
  Add c++17 nested namespaces runtime test for Python
  Add support for c++17 nested namespaces
  Update CHANGES.current
  .travis.yml: test against Octave 4.4
  Examples/test-suite/register_par.i: rename 'tree' to 'swig_tree'
  Examples/octave/module_load/runme.m: update 'exist()' statements for Octave >= 4.4
  Examples/octave/module_load/runme.m: do not use duplicate function names
  Examples/Makefile.in: unset OCTAVE_PATH when running Octave for tests
  Lib/octave: fix getting/setting global variables for Octave >= 4.4
  Lib/octave: use new class for function member dereference with Octave >= 4.4
  Lib/octave: fix operator installation for Octave >= 4.4
  Lib/Octave: in Octave >= 4.4, assign reference to base class in subclass
  Lib/octave: fix call to mlock() for Octave >= 4.4
  Lib/octave: fix call to octave::call_stack::current() for Octave >= 4.4
  Lib/octave: 'octave_exit' not longer exists in Octave >= 4.4
  Lib/octave: replace is_bool_type() with islogical() for Octave >= 4.4
  Lib/octave: replace is_numeric_type() with isnumeric() for Octave >= 4.4
  Lib/octave: replace is_cell() with iscell() for Octave >= 4.4
  Lib/octave: call octave::feval() instead of feval() for Octave >= 4.4
  Lib/octave: fix function name passed to unwind_protect::begin_frame()
  C#, D, Java methodmodifiers on destructors
  Javascript assert.h - move to header section
  Appveyor cl compiler warning fixes during configure
  Java vector wrappers cast correction
  test-suite fixes (Java directors) for compilers that don't support varargs
  Go - use director.swg like other languages
  test-suite fixes (2) for compilers that don't support varargs
  Consistent spacing in generated exception specifications
  test-suite fixes for compilers that don't support vararg macros
  Enhance Travis testing to use gcc 8 and test C++17 and C17
  Enhance SWIG_isfinite for older standards: C++03/C++98/C89
  test-suite support for gcc-8 targeting C++11 and C++14
  Scilab portability fixes - remove use of strdup
  Scilab array overbounds fix handling char type exceptions
  test-suite fix for c++17 and throw macro
  Remove use of 'register' in C source
  test-suite support for C++17: switch testing of the deprecated C++17 'register' keyword from C++ to C
  Examples update to support C++17: exception specification throw removal
  Cosmetic syntax tweak using throw in Octave directors
  test-suite support for C++17 (Java): exception specification throw removal
  test-suite support for C++17: exception specification throw removal
  __cplusplus macro usage tweak
  Improve detection of Python's 2to3 tool
  Correct C shared library creation when specifing CC to configure
  Remove superfluous parens in generated Python scripts.
  [ci] guile 2.2 build no longer expected to fail
  guile - resstructure some configure tests
  Disable guile configuration if guile-config and guile report a different version
  Fix guile executable detection on early 2.0.x guile versions
  guile - drop GDB_INTERFACE related stuff
  guile - replace obsolete scm_listify with scm_list_n
  guile - use more reliable method of finding guile executable based on guile-config
  Fix go version matching in configure for go1.10
  [Python] Suppress new pycodestyle warning
  Add if-no-present action for jsv8inc arg
  Fix typo in help --with-jscoreinc and --with-jscorelib
  Fix off-by-one error
  * Makefile.in (configfiles): Update URLs for latest configfiles.
  Add changes entry for Ruby %alias fix for global functions
  [Ruby] Pass Qnil instead of NULL to rb_funcall()
  Fix typo
  Fix ruby %alias directive for native c functions
  Stop testing Python on Appveyor msys/mingw
  Fix -Wimplicit-fallthrough gcc-7.3 warning
2018-05-17 19:57:02 +01:00
William S Fulton
220247c130 Test c++17 nested namespaces and %nspace 2018-05-14 21:03:31 +01:00
William S Fulton
348efc22ba Add support for c++17 nested namespaces
For example:
  namespace A::B { ... }
which is the equivalent to C++98 namespaces:
  namespace A { namespace B { ... } }
2018-05-14 21:02:10 +01:00
Vadim Zeitlin
b7f78dd5a7 Merge branch 'master' into doxygen 2018-03-19 21:54:46 +01:00
William S Fulton
b4f4ce4fd5 Fix Java swigReleaseOwnership() and swigTakeOwnership() regression
Fixes segfault when using non-director classes.
Restores a dynamic_cast which was previously removed.
The dynamic_cast is not needed for the swig_connect_director call ...
we'll have to find another solution for #449 for Java.

Closes #1184
2018-03-09 08:13:41 +00:00
William S Fulton
49af1907b8 Add missing Java throws clause for interfaces when using the %interface family of macros.
Fixes #1156.
2018-01-12 07:34:32 +00:00
William S Fulton
ce6960de92 Add more runtime typedef_classforward_same_name runtime testing 2017-12-31 16:37:27 +00:00
David Avedissian
6b2bcfed0b Added test case for a forward declaration in a typedef with the same
name
2017-12-27 16:36:45 +00:00
William S Fulton
923091da13 Changes to use common DirectorException class
Add director.swg for Go as was completely absent.
This is just the start of a common exception handling approach to directors.
An exception thrown in a Java director method will be propogated back to
Java via a C++ DirectorException.
DirectorException throws typemap for Java is fully working, all other languages need work.
DirectorException throws typemap for Perl added just to fix compilation errors.
Add director_exception_catches test.
2017-11-29 20:31:55 +00:00
William S Fulton
7aa28e37ec Java director exception handling improvements
When a director method throws an exception and it is caught by DirectorException
and passed back to Java using DirectorException::raiseJavaException, the Java
stack trace now contains the original source line that threw the exception.

Director exception handling code improved slightly to add some missing
ExceptionClear calls before calling JNI code.
2017-11-10 19:50:22 +00:00
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00
William S Fulton
e8ebadcded Add director shared_ptr typemaps for Java
Correct testcase to test T*const& rather than T*& typemaps
2017-10-16 18:21:31 +01:00
William S Fulton
d6077129e4 Testcase changes to satisfy pep8 E742 and E743 checks
Closes #1110
2017-10-09 07:27:38 +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
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
William S Fulton
f5e1856650 Expand std::shared_ptr testing to C# D Java Python 2017-09-22 20:03:47 +01:00