Commit graph

339 commits

Author SHA1 Message Date
William S Fulton
ae555c2339 Fix templated constructors regression
Templated constructors were incorrectly ignored because SWIG thought they were
methods without a return type.
Regression introduced in swig-3.0.0
Closes #245.
2014-12-09 23:48:37 +00:00
William S Fulton
80ae335319 Enhance C++11 strongly typed enums testcase 2014-11-27 19:56:08 +00:00
William S Fulton
49761fe347 Add Java runtime testcases for C++11 strongly typed enums 2014-11-25 07:08:02 +00:00
William S Fulton
0664ecdeb7 Fix strongly typed enums for Java when using simple enum wrappers 2014-11-24 07:04:54 +00:00
William S Fulton
296d45aec5 Merge branch 'alexey-pelykh-cpp11_strongly_typed_enums__direct_inject_in_java'
* alexey-pelykh-cpp11_strongly_typed_enums__direct_inject_in_java:
  Enhance cpp11_strongly_typed_enumerations testcase and turn it on
  Simplify/improve strongly typed enum implementation for Java
  Rewrite some Java director nested class support code for strongly typed enums
  Expand director_nested_class test to test more than one level of nesting
  Add director_nested_class testcase
  Removed useless code (it does not affect output, at least on our testcases)
  Java/Fix: swig_connect_director used not-fully-qualified classname (proper)
  Java/Fix: swig_connect_director used not-fully-qualified classname
  Java: fix generation of ProxyName when JNI descriptor is requested - for inner classes '$' should be used as separator instead of '/'
  Java: fix invalid director 'self' variable type name (wasn't fully qualified)
  Clean-up test suite and fix issue with nspace, as well as keep the fix for Class::Struct::EnumClass being JNI-referenced as Struct_EnumClass
  C++11 strongly-typed enums fix for Java only (proper)
  Revert "C++11 strongly-typed enums fix for Java only"
  Additional test cases for C++11 strongly-typed enums
  C++11 strongly-typed enums fix for Java only
2014-11-21 07:34:12 +00:00
William S Fulton
92d3146a06 Expand director_nested_class test to test more than one level of nesting 2014-11-10 19:57:49 +00:00
William S Fulton
bca042a7dd Add director_nested_class testcase
Java nested director class test for fix in e7db081d5e
2014-11-07 19:50:20 +00:00
David Nadlinger
a9d7b7f40c Work around D test suite failure due to issue #254.
Object is currently a D keyword for the purposes of SWIG
(that's in fact a little too strict, but Object is the root
of the class hierarchy and some parts of the code break).
'template_typedef_typedef' is supposed to test.
2014-11-06 23:04:35 +01:00
William S Fulton
bfde148887 The kwargs feature no longer turns on compactdefaultargs for languages that don't support kwargs.
Affects all languages except Python and Ruby.

Closes #242
2014-10-21 07:34:51 +01:00
William S Fulton
8441e3eab4 Java gc tests failure fix
Sometimes the GC just won't run the finalizers, so we output a warning
instead of throwing an error, so now the test-suite will pass but with a
warning if the number of objects is not as expected.

Was notably failing on RHEL6 using OpenSUSE build testing with openjdk-1.6
2014-10-14 19:22:25 +01:00
Yuval Kashtan
093fe2a556 Add support for java.nio.Buffer
including test-suite test case and documentation
2014-07-18 15:45:16 +03:00
William S Fulton
81d023ac05 Merge branch 'wkalinin-csymbols-2' - %extend and nested structs
* wkalinin-csymbols-2:
  Add runtime test for %extend and nested union
  test fixed
  %extend symbols for nested structs get into a wrong C symbol table
2014-06-02 07:11:22 +01:00
William S Fulton
5f3ee109c8 Add runtime test for %extend and nested union 2014-06-02 07:09:35 +01:00
William S Fulton
78719759d5 Test-suite makefile fixes for Windows
Remove $(realpath ) which is no good for Windows executables running
under Cygwin's make
2014-05-28 23:44:55 +01:00
William S Fulton
243671700f Fix li_boost_intrusive_ptr for various versions of boost
Modify testcase to fix compile errors on various versions of boost.
Tested using various combinations from boost-1.33/gcc-3.4.2 to
boost-1.53/gcc-4.7.3. Originally noticed as broken on
boost-1.36/gcc-4.3.4 on SLE 11.

Add in some diagnostics when reference count is wrong... which does
still happen occasionally.
2014-05-18 23:29:06 +01:00
William S Fulton
2f25b68d10 Merge branch 'kwwette-out-of-src'
* kwwette-out-of-src:
  Configured languages display improvement
  Fix out of source clean-android-examples
  Neaten up test-suite Makefile regeneration
  Remove duplicate test target in CCache Makefile
  Add in CPPFLAGS and LDFLAGS to examples/test-suite
  Remove unnecessary make invocation when running test-suite
  gitignore to ignore build directory names
  Partially fix R out of source test-suite
  Update all languages to use SCRIPTDIR
  Slight simplification of test-suite build for new out-of-source changes
  Allow examples and test-suite to be built out of source tree
  Add "make maintainer-clean" to Travis CI build
  CCache/Makefile.in: fix to allow out of source tree check/install
  Regenerate configured Makefile if Makefile.in or config.status have changed
  Fix segmentation fault in some Javascript examples
  configure.ac: print configured languages at end of configuration
2014-05-15 23:32:10 +01:00
William S Fulton
2b5499a262 Slight simplification of test-suite build for new out-of-source changes
Provide default SRCDIR and SCRIPTDIR variables in common.mk and override
only where needed.
2014-05-15 23:11:07 +01:00
William S Fulton
9b0e484b8a Tests for C nested classes symbol table not being in global space
Tests for 55bda53145
2014-05-12 07:51:55 +01:00
Karl Wette
f574a34155 Allow examples and test-suite to be built out of source tree
- Examples/Makefile.in rules use SRCDIR as the relative source directory

- ./config.status replicates Examples/ source directory tree in build
  directory, and copies each Makefile to build directory, prefixed with
  a header which sets SRCDIR to source directory

- Examples/test-suite/.../Makefile.in set SRCDIR from Autoconf-set srcdir

- Examples/test-suite/errors/Makefile.in needs to filter out source
  directory from SWIG error messages

- Lua: embedded interpreters are passed location of run-time test

- Python: copy run-time scripts to build directory because of 2to3
  conversion; import_packages example copies __init__.py from source
  directory; test-suite sets SCRIPTDIR to location of run-time tests

- Javascript: binding.gyp renamed to binding.gyp.in so that $srcdir
  can be substituted with SRCDIR; removed './' from require() statements
  so that NODE_PATH can be used to point Node.js to build directory
2014-05-11 23:21:10 +02:00
Karl Wette
d5b765d388 Whitespace cleanup of all Makefiles*
- some of the %.clean rules in the test-suite Makefiles were using a single tab
  as an empty rule, dangerous! I've replaced these with the safer '@exit 0'.
2014-05-02 20:06:11 +02:00
William S Fulton
50a9c5fbec Add C++11 constexpr runtime test 2014-03-31 19:29:19 +01:00
William S Fulton
15f4b3b19d Correct messages displayed when running Java test-suite 2014-03-28 07:48:40 +00:00
William S Fulton
87963d2e68 Java/C# smart pointer tests: Give GC more time to collect objects 2014-03-16 00:44:30 +00:00
William S Fulton
01ce992f5d C++11 result_of testcase 2014-03-14 01:57:16 +00:00
William S Fulton
09cfc53bdf Better error detection in some java testcases 2014-03-01 16:14:36 +00:00
Olly Betts
2f3bf144c6 Fix assorted comment and documentation typos 2014-02-23 17:15:22 +13:00
William S Fulton
4f3c77051f Slight wording change when running test-suite
Should be easier to parse 'by eye'
2014-02-22 20:51:27 +00:00
William S Fulton
90a9d750c9 Add support for cdata library for Java 2014-02-15 22:13:50 +00:00
William S Fulton
2f47bb8d67 Typedef typedef prefix test for templates
As given in Diorcet Yann's example in issue #50
2014-01-14 07:20:06 +00:00
William S Fulton
07ce3fb746 Add testcase for %attributestring on shared_ptr 2014-01-11 19:34:22 +00:00
William S Fulton
c34d7f6d23 %naturalvar feature fixes and documentation
Fix and document the naturalvar feature override behaviour - the naturalvar
feature attached to a variable name has precedence over the naturalvar
feature attached to the variable's type. The overriding was not working
when turning the feature off on the variable's name.

Fix so that any use of the naturalvar feature will override the global
setting. Previously when set globally by -naturalvar or %module(naturalvar=1),
use of the naturalvar feature was not always honoured.
2014-01-11 19:32:43 +00:00
Vadim Zeitlin
ad02cb98e6 Relax Java preproc_line_file unit test to pass in a separate build directory.
Exact paths comparison doesn't work when SWIG is built in a directory
different from the source one, so check whether the path just ends with the
expected path components instead.

This allows all Java tests to pass in this build configuration.

closes #115
2013-12-23 20:42:48 +00:00
Vladimir Kalinin
b4fef06c42 fixed %template within %extend, test added
fixed language symbol table nested classes name separator, test added
fixed %feature "flatnested" working with %extend
fixed Swig_offset_string for empty string
added simple template to save/restore values in current scope (readability reasons)
2013-12-19 02:11:22 +04:00
Vladimir Kalinin
865408874f fixed %template declared within class, next to template declaration
added a few tests for C# nested classes support
2013-12-16 11:43:28 +04:00
William S Fulton
314fae460b Merge branch 'nested' - nested structs/classes support
* nested:
  Deprecation of the 'nestedworkaround' feature
  Ensure -c++out is not used with -c++
  Add missing header to new source file
  Nested C class setters restored in c++out mode for Octave
  Classprefix fixed after private nested classes some comments and spaces added
  Fix template partial specialization detection
  Minor tweaks in Swig_feature_set
  Swig_offset_string moved to misc.c
  nested private classes are discarded while parsing nested relate functions are moved to nested.cxx and renamed accordingly
  out-of-scope template definitions fixed nested_private test disabled again
  fixed out-of-scope nested class definitions, added a test enabled nested C structs assignment (still disabled for Octave), added Java runtime test fixed nested_private test case for Java & C#
  Testcase of private nested class usage causing segfault
  C nested struct passed by value example
  Add in Travis testing for nested branch
  Add C++ nested class example
  Minor code improvements
  Cosmetics/code beautification of nested class support
  Nested classes support
2013-12-14 15:12:07 +00:00
Vadim Zeitlin
ed28725a15 Add std_auto_ptr.i defining typemaps for returning std::auto_ptr<>.
These typemaps are currently defined for C#, Java and Python only and the
tests are provided only for these languages.

Also add a brief description of the new header to the documentation.
2013-12-03 23:45:20 +01:00
Vladimir Kalinin
e1a4e11bea fixed out-of-scope nested class definitions, added a test
enabled nested C structs assignment (still disabled for Octave), added Java runtime test
fixed nested_private test case for Java & C#
2013-12-04 01:53:42 +04:00
Vladimir Kalinin
b63c4839fe Nested classes support
Closes #89
Squash merge branch 'master' of https://github.com/wkalinin/swig into wkalinin-nested

By Vladimir Kalinin
* 'master' of https://github.com/wkalinin/swig:
  CPlusPlusOut mode for Octave
  nested class illustration
  fixed "Abstract" flag for nested classes added an example enabled anonymous nested structs runtime test
  porting
  warnings disabled
  porting fixes
  java runtime tests ported
  nested class closing bracket offset fixed
  removed double nested template (not supported by %template parsing)
  template_nested test extended
  parent field made public
  property access fixed
  replaced tabs with spaces
  warning W-reorder
  deprecated warnings removed, derived_nested runtime test added
  optimized string indenting
  Nested classes indenting
  nested classes docs
  fixed the order in which flattened inner classes are added after the outer
  Private nested classes were getting into the type table.
  Java getProxyName() fix for nested classes fixes the case when nested classes is forward declared
  Fix for a case when a nested class inherits from the same base as the outer. (Base class constructor declaration is found first in this case)
  merge fix
  nested C struct first immediate declaration incorrectly renamed sample fixed
  tests updated to reflect nested classes support
  Java nested classes support (1)
  flattening should remove the link to the outer class
  access mode correctly set/restored for nested classes
  nested templates should be skipped while flattening (template nodes themselves, not expanded versions) also non-public nested classes should be ignored
  If nested classes are not supported, default behaviour is flattening, not ignoring flag "nested" is preserved, so, the nested classes can be ignored by user
  nested workaround test updated
  template instantiated within a class is marked as nested for ignoring purposes
  %ignore not applied to the nested classed, because "nested" flag is set too late
  typedef name takes precedence over the real name (reason?)
  unnamed structs should be processed for all the languages
  nested C struct instances are wrapped as "immutable"
  tree building
  typedef declaration for unnamed C structures fixed
  nested classes "flattening"
  fixed %ignoring nested classes
  renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface
  renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface
  tree iteration fix
  dirclassname variable names unified memory issue fixed
  merge error
  ignore unnamed structs for C++
  unnamed nested C structs naming & unnesting
  class added to classes hash under typedef name
  private nested classes skipped
  test updated due to nested templates support
  anonymous structs with inheritance fixed nested_class test to allow anonymous structs w/o declarator
  tests updated: nested workaround removed from namespace_class.i propagated nested template declaration to the C++ file
  injected members scope
  nested tempplates fixes, nested structures in "C" mode parsing added utility function "appendSibling" (like "appendChild")
  nested unnamed structures parsing fixes, access mode restored on nested class end, tdname is properly patched with outer class name prefix
  memory management fixes
  nested templates (1)
  Nested unnamed structs
  Nested class support (1)
  Nested class support (1)
2013-11-29 07:02:34 +00:00
William S Fulton
baec61c5ab java_director_exception_feature_nspace test case changes
- The implementation for SEP for the classpath is not portable, eg the
separator should be ':' not ';' on Cygwin, but clearly it could be ';'
if using a native Windows version of Java. In the past the test-suite
has been constructed to avoid this problem and these changes go back to
this approach at the expense of not testing nspace without -package (but
not specifying -package is quite unusual when using nspace, so no great
loss). This test could be restored to how it was if the separator is
detected at configure time from the JVM itself, eg by calling Java code:

  System.out.println(System.getProperty("path.separator"));

- Mangle the non-public classes in the _runme.java file so that they are
unique to this testcase (the .class files generated can interfere with
other tests).

- Const corrections and spelling mistakes fixed in test case.

test case improvements
2013-11-07 22:50:08 +00:00
Marvin Greenberg
6736e74127 Add feature director:except for improved director exception handling in Java
Closes #91
2013-10-22 20:44:35 +01:00
Vadim Zeitlin
72afb74f47 Add support for case conversion characters in regex substitutions.
Allow using Perl-like \l, \L, \u, \U and \E escape sequences in the
substitution string used with %rename("%(regex:/pattern/subst/)s").
This is useful for e.g. title casing all string after removing some prefix.

Closes #82
2013-10-15 07:17:56 +01:00
William S Fulton
b17456e617 Merge branch 'gsoc2009-matevz' into master - C++11 support
* gsoc2009-matevz:
  Minor cleanup prior to merging to master
  Add gsoc2009-matevz for Travis testing
  C++11 testing moved to a configure option
  Rename all C++0x to C++11 and cpp0x to cpp11
  Grab .travis.yml file from master to turn on Travis testing
  Suppress leaking memory warnings in rvalue reference tests
  Add support for extern "C++" - no warning should be issued as was previously occurring
  Add support for extern "C" thread_local
  Fixes detecting if a variable is extern when using 'extern thread_local'
  Add support for thread_local when specified with other legitimate storage class specifiers - extern and static
  Remove test tokens
  User defined literals: fix for %rename and update docs
  Add ability to suppress variadic template first argumnet warning
  Add template aliasing and type aliasing into symbol table and enable explicit warning suppression for these. They still need to be added into the parse tree and dealt with.
  Add lambda functions to the symbol tables and add ability to suppress lambda warnings.
  Rework std::initializer_list handling to warn about usage in any method, not just constructors. A typemap is used to issue the warning and can be overridden with user defined behaviour.
  Initialization list doc updates and new tests. Fix functions with default arguments that are initializer lists
  Better clarification about polymorphic wrappers for function objects - std::function
  Remove generated output that should not be checked in2
  Fix shift/shift and shift/reduce errors around variadic templates since merge
  Variadic templates doc update
  Add rvalue reference typemaps
  Add rvalue reference typemaps
  Add rvalue reference typemaps
  Add rvalue reference typemaps
  Add rvalue reference typemaps
  Add rvalue reference typemaps
  Add rvalue reference typemaps
  Add rvalue reference typemaps
  Use CXXFLAGS for c++ code for Go examples
  Add missing static member to testcase
  More rvalue reference typemaps
  Fix generated code for rvalue references by converting functions returning an rvalue reference into something that can be taken the address of - via a const ref cast. Now the rvalue_reference tests compile under g++-4.7 (C# only atm)
  Remove recently added %expect in parser in case of backward compatibility problems
  Cosmetic changes to previous (unicode literals) commit
  Fixes to previous (unicode literals) commit
  Unicode literals
  Add check-cpp11 target for testing c++11 only tests
  Improve detection of C++11 compiler and set appropriate flags to use C++11/C++0x features
  Modify autoconf macro to be more flexible about how it is used - sets CXX11FLAGS, HAVE_CXX11_COMPILER and option to not error out
  Autoconf archive macro to detect c++11 - as downloaded from archive
  Update variadic templates
  result_of not working
  Add lambda tests to test-suite - gcc-4.7 supports these
  One more lambda test using constexpr
  More lambda support - for optional lambda declarators
  Add in support for initialising auto variables from lambda expressions
  Lambda expressions: parse exception specification in lambda functions. Fix lambda testcase for gcc-4.7.
  Delegating constructors and inheriting constructors clarification and split of tests
  gcc-4.7 now supports alias templates
  Update on C++11 user-defined literal status
  Fix unrestricted unions testcase and add runtime example
  Minor doc tweaks for unrestricted unions
  Some updates to c++11 warning messages and update docs on alias templates
  Provide unique c++11 warnings which were previously hijacking another warning
  Tidy up test and docs on template double brackets
  Better clarify C++11 smart pointer support
  Update c++0x tests run by default for g++-4.6
  Improve nullptr constant wrapping
  Add scoped enums into correct correct scope in type system. Note that cpp0x_strongly_typed_enumerations.i still shows further language symbol table problems which need fixing.
  Using C++11 enum classes with just a forward reference.
  Add support for c++11 strongly typed enums inheriting from non standard primitive types
  Fix parsing of forward declaration of C++0x enums
  html fixes
  sort out c++0x lambda tests and reorder cpp0x tests
  Improved C++0x rvalue reference implementation differentiating lvalue and rvalue references. The previous implementation treated rvalue references as lvalue references which leads to a number of different wrapping issues.
  simple formatting changes
  Warning suppression for explicit template instantiations
  Raw string literal changes in paper N3077 changes delimiters to use round brackets instead of square brackets
  add in more raw string literals for gcc-4.5
  typo fix
  minor warning message changes
  Add new GPL license headers to all source files in this branch
  merge revisions 11872:11876 from trunk to gsoc2009-matevz branch - license changes
  Grammar and formatting improvements
  Added developer documentation for C++0x.
  Fixed testcase warnings.
  Documented C++0x testcases.
  Updated C++0x User's manual.
  Removed decr-- Hash tables feature. Added some comments.
  Added draft user documentation for the C++0x.
  Added warning for initializer_list introduced in C++0x. Added testcase cpp0x_initializer_list.
  Fixed cpp0x_result_of testcase. Added testcase cpp0x_sizeof_object.
  Added testcase for default/delete arguments introduced in C++0x.
  Added cpp0x_result_of testcase.
  Added syntax support for template aliasing and new 'using' syntax for typedefs introduced in C++0x. Added testcase cpp0x_template_typedefs.
  Added testcase cpp0x_constructors for delegating constructors and constructor inheritance.
  Added initial support for C++0x decltype(). Added testcase cpp0x_decltype.
  Added support for user-defined string literals. Added testcase cpp0x_userdefined_literals.i
  Fixed compilation error.
  Added syntax for lambda expressions and closures introduced in C++0x. Added testcase cpp0x_lambda_functions.i.
  Fixed variadic template argument warning.
  Enabled support for variadic %template directive.
  Enabled alternate function syntax and added runtime testcases. Added support for null pointer constant introduced in C++0x.
  Fixed S/R and R/R conflicts. Fixed testcase for rvalue reference.
  Added variadic '...' syntax for inheritance introduced in C++0x. Added sizeof... syntax introduced in C++0x.
  Added initial support for variadic templates.
  Added partial support for unordered_ STL types.
  Added support for C++0x rvalue and move semantics. Added testcase.
  Added initial support for parsing C++0x strongly typed enumerations.
  Fixed bug in cpp0x testcase.
  Added testcase for cpp0x unrestricted unions.
  Disabled alternate function syntax testcase.
  Added testcase for function objects.
  Added initial support for hash tables unordered_ types.
  Added C++0x test case for the hash_tables.
  Added support for C++0x alternate function syntax. Added testcase.
  Added support for cpp0x uniform initialization. Added testcases.
  Fixed cpp0x_raw_string_literals.i test case.
  Added testcase for shared_ptr, unique_ptr and weak_ptr.
  Added keyword 'thread_local' to Swig. Added testcase.
  Added test case.
  Added C++0x support for 'extern' explicit template instantiation without the translation unit. Added test cases.
  Added support for C++0x static_assert().
  Added support for custom string delimiters.
  Added support for unicode strings and fixed support for wstrings. Added test case cpp0x_raw_string_literals.i.
  Added test case for explicit conversion operators. Some cosmetic fixes.
  Added constexpr keywords and CONSTEXPR terminal to Swig parser. Added cpp0x_constexpr.i testcase. Fixed compilation bug of cpp0x_template_double_brackets.i testcase. Removed obsolete cpp0x_template_double_brackets_broken.
  Introduced new CXXFLAGS symbol for the compilation of test suite. Added -std=c++0x to g++ compiler to enable compilation of the new C++0x tests.
  Renamed template_double_brackets -> cpp0x_template_double_brackets. Added CPP0X_TEST_CASES and CPP0X_TEST_BROKEN in common.mk.
  Added support for template double brackets for C++0x. Added test cases.
2013-10-11 21:52:05 +01:00
William S Fulton
e5f9f91807 Add naturalvar_more testcase runtime test 2013-10-11 19:42:19 +01:00
William S Fulton
bcb7aee022 Merge branch 'master' into gsoc2009-matevz
Conflicts:
	Examples/Makefile.in
	Examples/guile/Makefile.in
	Lib/php/php.swg
	Makefile.in
	Source/CParse/parser.y
	configure.ac
2013-10-10 07:26:09 +01:00
William S Fulton
738cc36aab Rename all C++0x to C++11 and cpp0x to cpp11 2013-10-07 20:37:00 +01:00
William S Fulton
439a353a36 Document patch #33 from previous commit and complete run time tests 2013-04-18 23:20:48 +01:00
William S Fulton
857e447654 Fix syntax error when preprocessor macros are defined inside of enum lists
Fixes SF Bug 428, Patch 333
2013-04-18 22:48:42 +01:00
William S Fulton
8778724768 Add support for extern "C++" - no warning should be issued as was previously occurring 2013-02-08 18:55:16 +00:00
William S Fulton
e44656cfe5 Add support for extern "C" thread_local 2013-02-08 18:45:29 +00:00
William S Fulton
b725625e6f Add support for thread_local when specified with other legitimate storage class specifiers - extern and static 2013-02-08 06:36:39 +00:00