Commit graph

3,397 commits

Author SHA1 Message Date
William S Fulton
3518cbfd33 Typo in comment fix 2014-02-08 09:00:52 +00:00
Vladimir Kalinin
e9ecac9298 warnings suppressed for deeply nested classes 2014-02-07 07:39:07 +04:00
Vladimir Kalinin
56cea1821d warning filter fixed 2014-02-06 23:47:01 +04:00
Vladimir Kalinin
bda9c90e2b warnfilter fixed
scoping for "anonymous forward declaration" fixed
2014-02-03 02:21:44 +04:00
Vladimir Kalinin
4744ea8903 added forward declaration instead of ignored nested class (resurrected old code) 2014-02-03 01:03:37 +04:00
Vladimir Kalinin
2f3d93e93a Nested classes support is diversified, depending on the language capability. If the language cannot support nested classes, they will be unconditionally moved to the global namespace. If language module does not override Language::nestedClassesSupport() function, nested classes will be ignored, unless "feature:flatnested" is used. 2014-02-02 22:38:13 +04:00
Vadim Zeitlin
a1fe8a6501 Fix gcc strict aliasing warnings with function pointers too.
The commit 40bf877 fixed warnings about converting between function and object
pointers but introduced warnings about breaking strict-aliasing rules which
appear with -Wstrict-aliasing which is implicitly enabled by -O2.

Avoid these warnings as well by using an intermediate union for conversion
instead of casts trickery.
2014-02-01 15:00:15 +01:00
Ian Lance Taylor
fa9a6d58ed [Go] Fix handling of C type "long" on 32-bit systems. It was broken
for C++ long& and for big-endian systems in general.
2014-01-27 17:49:35 -08:00
Ian Lance Taylor
f2dc3a9c1f [Go] Add %go_import directive. 2014-01-21 11:27:09 -08:00
William S Fulton
d7e614f716 Remove debug output on 'Empty character constant' error 2014-01-19 00:23:42 +00:00
Yann Diorcet
c319ad9dd6 Resolve prefix when resolving typedef 2014-01-12 00:17:16 +00:00
William S Fulton
5c6bc5db3e Remove -nonaturalvar and nonaturalvar option in %module
These didn't work, were not documented and don't seem necessary
2014-01-11 19:34:44 +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
40bf877499 Work around gcc warning about function pointers conversions.
Work around harmless (at least under POSIX systems where function pointers are
guaranteed to have the same representation as object pointers) but annoying
warnings given by gcc when converting between function and object pointers, e.g.

Source/DOH/fio.c: In function 'DohEncoding':
Source/DOH/fio.c:51: warning: ISO C forbids conversion of function pointer to object pointer type
Source/DOH/fio.c: In function 'encode':
Source/DOH/fio.c:75: warning: ISO C forbids conversion of object pointer to function pointer type
Source/DOH/base.c: In function 'DohCall':
Source/DOH/base.c:952: warning: ISO C forbids conversion of object pointer to function pointer type

Use an extra level of pointer indirection to avoid them.
2014-01-10 14:38:54 +01:00
Ian Lance Taylor
90eb5f9095 [Go] Fix bug that broke using directors from a thread not created by Go. 2014-01-06 09:28:52 -08:00
William S Fulton
6a72e16b37 Add C++11 virtual specifier sequences (final and/or override on methods)
Parsing support added. The final and override information is not used or
added to the parse tree atm.
2014-01-03 20:17:48 +00:00
Vladimir Kalinin
3412cc2f64 Merge pull request #123 from wkalinin/test2
fixed enums & enum values language symbol table namespace
fixed skipping of %templates in %extend if they are in the wrong scope
2013-12-26 00:33:28 -08:00
William S Fulton
44dd28950c Python import code beautify 2013-12-24 17:22:42 +00:00
Paweł Tomulik
5562deec62 Fixed SF bug #1297 (Python imports)
This changeset resolves several issues related to python imports.
For example, it's possible now to import modules having same module
names, but belonging to different packages.

From the user's viewpoint, this patch gives a little bit more control on
import directives generated by swig. The user may choose to use relative
or absolute imports (docs are provided in separate PR).

Some details:
  - we (still) generate import directives in form 'import a.b.c' which
    corresponds to absolute imports in python3 and (the only available)
    ambiguous one in python2.
  - added -relativeimport option to use explicit relative import syntax
    (python3),

Tests are under Examples/python, these are in fact regression tests but
with the current swig testing framework it seems to be impossible to put
appropriate tests under test-suite.

Closes #7
2013-12-24 17:22:25 +00:00
Vladimir Kalinin
6b7185989a additional check for template type, to handle constructors correctly 2013-12-24 06:47:54 +04:00
William S Fulton
1a19451c1b Error out attempting to use directors without -c++
Remove redundant #ifdef __cplusplus markers in director.swg
2013-12-23 20:23:54 +00:00
William S Fulton
279ebdc0cf Beautify director output 2013-12-23 18:21:52 +00:00
William S Fulton
d1bb451eab Merge branch 'perl5-directors-minimal' of https://github.com/talby-/swig into talby--perl5-directors-minimal
* 'perl5-directors-minimal' of https://github.com/talby-/swig:
  try adding travis ci to this branch
  ran "beautify-file" make target over perl5.cxx patch hunks and rewrote callback and extend examples in the style of existing examples
  prefer polymorphism on existing destructor over custom destructor method
  fix string mangled by tidy
  eliminate dead director code and convert remaining blocks
  mitigate ConvertPtr director cost when directors are not enabled
  steals python director docs and adapts to perl5
  adds "callback" and "extend" examples
  don't forget the most important part
  steals python directors and adapts to perl5
2013-12-23 07:30:37 +00:00
Vladimir Kalinin
715e254e05 fixed enums & enum values language symbol table namespace
fixed skipping of %templates in %extend if they are in the wrong scope
2013-12-20 07:37:49 +04:00
William S Fulton
257a9865e9 Make save_value non-copyable 2013-12-19 18:12:19 +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
Ian Lance Taylor
ba049db40b Remove Go -longsize option. 2013-12-17 17:37:55 -08:00
Ian Lance Taylor
532da6989c [Go] Add -go-pkgpath option. 2013-12-17 13:50:39 -08:00
Vladimir Kalinin
25689857eb Language::addSymbol fix, to handle classes correctly 2013-12-17 12:14:33 +04:00
Ian Lance Taylor
1dca0af024 Update for Go 1.2 release. Add support for linking SWIG code directly
into executable, rather than using a shared library.
2013-12-16 19:50:17 -08:00
Vladimir Kalinin
5487345ce7 properly disabled nested %template declared in other scopes 2013-12-16 13:08:34 +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
a1c17d585d Fix R unions seg fault
Started seg faulting since nested branch merge
2013-12-14 22:35:02 +00: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
Ian Lance Taylor
4cf5de797f Add comment with SWIG file name in files generated for Go. 2013-12-13 11:56:31 -08:00
William S Fulton
0f4ceaf592 Deprecation of the 'nestedworkaround' feature
Also add in macros for the flatnested feature which can be used in place
of the nestedworkaround feature
2013-12-13 08:11:17 +00:00
William S Fulton
2121e1217e Ensure -c++out is not used with -c++
Error checking for this combination implemented as well as correcting
Octave

Also refactor, replacing CPlusPlusOut variable with cparse_cplusplusout
for an implementation which more closely resembles cparse_cplusplus which
is also required in both .c and .cxx files.
2013-12-12 20:52:44 +00:00
William S Fulton
3b4d331310 Add missing header to new source file 2013-12-12 09:00:23 +00:00
William S Fulton
e95ac82651 Nested C class setters restored in c++out mode for Octave
Suitable casts are required so that assignment of instances of nested classes
work as the nested class is duplicated in the global namespace, eg:

struct Outer {
  struct Nested {
    int bar;
  } bar_instance;
};

Outer.bar_instance can now be assigned to.
2013-12-12 09:00:16 +00:00
Miklos Vajna
227192f80a Fix Examples/php/pointer to work with PHP 5.5
With this, all examples work with PHP 5.5 for me.
2013-12-12 15:52:51 +13:00
Olly Betts
cecd89f66f [PHP] The usage of $input in PHP directorout typemaps has been
changed to be consistent with other languages.  The typemaps
provided by SWIG have been updated accordingly, but if you
have written your own directorout typemaps, you'll need to
update $input to &$input (or make equivalent changes).

*** POTENTIAL INCOMPATIBILITY  ***
2013-12-12 15:40:15 +13:00
Olly Betts
c6e4dea572 Fix a few typos in comments and docs 2013-12-12 11:45:30 +13:00
Vladimir Kalinin
cf3696e8f9 Merge branch 'nested' of https://github.com/swig/swig into nested 2013-12-08 01:47:01 +04:00
Vladimir Kalinin
44323e14b3 Classprefix fixed after private nested classes
some comments and spaces added
2013-12-08 01:46:38 +04:00
William S Fulton
67848e377a Fix template partial specialization detection
Fixes template definitions that should be ignored and warnings introduced after nested changes:
../../../Examples/test-suite/refcount.i:63: Warning 318: Instantiation of template 'RCPtr< A >' is ambiguous,
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' used,
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' ignored.
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' ignored.
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' ignored.

Different/clearer implementation of constructor detection since Classprefix is
not behaving the same since nested changes were introduced. Only accept
constructors if in extend mode or in a class.

Also remove unused "isextension" attribute on the nodes.
2013-12-07 16:22:44 +00:00
William S Fulton
6d97335d94 Minor tweaks in Swig_feature_set 2013-12-05 21:21:07 +00:00
William S Fulton
7103a06849 Swig_offset_string moved to misc.c 2013-12-05 20:59:09 +00:00
Vladimir Kalinin
b0afa8a95c nested private classes are discarded while parsing
nested relate functions are moved to nested.cxx and renamed accordingly
2013-12-05 20:41:22 +04:00
Vladimir Kalinin
053c605df0 out-of-scope template definitions fixed
nested_private test disabled again
2013-12-04 16:21:33 +04:00
William S Fulton
5504bd3201 decltype fix on missing type info 2013-12-04 00:24:40 +00:00