Commit graph

430 commits

Author SHA1 Message Date
William S Fulton
b851e45e0a Fix seg fault for global declarations declared erroneously without a name 2017-03-10 23:25:31 +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
0ccef1424a C++11 alternate syntax for function declarations improvements
Functions can now be declared const/noexcept/final etc
2017-03-10 23:25:31 +00:00
William S Fulton
fc638814ae Add support for unnamed parameters: member const function pointers 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
Asen Alexandrov
a6e9c087d8 [Issue 905] Add recognition for throw (.+) final|override in parser.y
PROBLEM:
 There is a small ommission in parser.y, which will lead
 to syntax errors in cases when non-empty throw declaration is
 followed by `override`, `final` or both. E.g. in cases like:

       void finalOverriden() throw(std::exception) final override;

SOLUTION:
 - Add a `THROW LPAREN parms RPAREN virt_specifier_seq` to
   exception_specification in Source/CParse/parser.y
 - Add several methods in test-suite/cpp11_final_override.i
   to verify the fix works.
2017-02-27 10:08:23 +13:00
William S Fulton
83519138e8 Tweak %extend templates
Previous commit turned on the generation of an extra extend function
wrapper of a member template function when %template was inside a %extend
block instead of calling the real member template - reversed this side
effect.
2017-01-24 19:01:43 +00:00
William S Fulton
449aa08124 %extend changes and remove default use of javatype, dtype, cstype %typemaps
1) The %extend directive can now optionally support one of the 'class', 'struct' or 'union'.
2) The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
   completely freeing them up for users to use without having to replicate the library
   code that they previously added

Tested by changes to test: java_lib_arrays
2017-01-15 16:50:24 +00: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
William S Fulton
c74397bfd0 Merge branch 'liorgold-alias-template'
* liorgold-alias-template:
  Warning header cosmetics
  Fix decl attribute in C++11 alias templates
  Add C++11 alias templates
2016-11-02 09:10:59 +00:00
Jiulong Wang
256e283fc3 Fix #define error when value contains char in compound expression 2016-10-02 13:01:16 -07:00
Jiulong Wang
e1afb6fdbe Fix enum error when value contains char in compound expression
Problem: When enum value contains compound expression with a char
constant, the quotes around char constant is missing in the generated
expression. Example:

enum media_type {
  YUY2 = ((('2' << 24) | ('Y' << 16)) | ('U' << 8)) | 'Y'
};

The generated C# enum becomes:

public enum media_type {
  YUY2 = (((2 << 24)|(Y << 16))|(U << 8))|Y
}

While the correct representation (after this fix) should be:

public enum media_type {
  YUY2 = ((('2' << 24)|('Y' << 16))|('U' << 8))|'Y'
}

Causes: the exprcompound promotes the expression type from char to int
and uses $1.val in the generated expression. However $1.val does not
contain the quotes. Since the type is promoted to int, there's no way to
know there's char component in the compound expression.

Solution: in exprcomound, use $1.rawval if $1.type is T_CHAR or T_WCHAR.
The rawval contains quotes which yield correct expression.
2016-09-07 15:46:16 -07:00
Lior Goldberg
4efc3afd6d Fix decl attribute in C++11 alias templates 2016-08-23 00:53:09 +03:00
Lior Goldberg
d0fc5b7b5b Add C++11 alias templates 2016-07-06 00:31:04 +03:00
Lior Goldberg
c363a93d69 Added support for type alias 2016-06-22 23:13:28 +03:00
William S Fulton
15ebf3df03 Fix assertion handling defaultargs
Occurs when using %extend for a template class and the extended methods
contain default arguments.

Closes #611
2016-05-07 12:33:29 +01:00
Vadim Zeitlin
3b58402cb2 Complain about any new shift/reduce conflicts in the grammar
Uncomment the "%expect" statement, there are no known Bison versions for which
it doesn't work and it's useful to fail the build if any new conflicts are
introduced.

Closes #478.
2016-04-20 01:50:04 +02:00
Olly Betts
9bb6e0e860 Fix reversed mapping of < and > in commented code 2016-03-29 09:57:07 +13:00
William S Fulton
7339de974d Fix static const char member variables wrappers with %javaconst(1).
This fixes the case when an integer is used as the initializer, such as:

  struct W { static const char w = 100; };

The "valuetype" attribute has been added to the "cdecl" Node which enables
us to distinguish the declared type from the type of the initializer.
2016-01-27 09:01:00 +00:00
William S Fulton
593c452c37 Fix overloaded templates and default arguments
The defaultargs attribute was not being correctly set for functions with
default arguments when instantiated with %template.

Closes #529
2015-10-11 17:30:34 +01:00
Vladimir Kalinin
ec93b01a09 Issue #508: Classprefix is not restored after nested structures processing. Also, Classprefix is incorrectly checked in some places. 2015-10-01 15:06:42 +03:00
William S Fulton
01d4bc391c OS X bison warning suppression 2015-08-31 14:05:04 +01:00
Vladimir Kalinin
366e8a9f06 Restored broken ignoring of operators etc. Added more comments.
Added check for explicit $ignore, to allow correct using protected symbols

This is a single commit for patch #476
2015-07-30 08:40:52 +01:00
Vladimir Kalinin
c7e4c2d418 refactoring: 2 ways of ignoring symbol in add_symbols() merged for clarity 2015-07-22 15:40:13 +03:00
Vladimir Kalinin
6915061b7d explicitly %ignore'd symbol does not get feature:ignore if it is only added to C symbol table 2015-07-21 19:30:44 +03:00
William S Fulton
8ccf639f42 String / char * usage in parser fixes 2015-07-17 18:14:25 +01:00
William S Fulton
2e03845be8 const char * fixes in the parser 2015-07-17 17:50:11 +01:00
William S Fulton
edcdaaec16 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
William S Fulton
05397cf6a2 Fix syntax error when the template keyword is used in types
For example:
  std::template vector<int> v;
2015-07-02 19:23:37 +01:00
William S Fulton
0b436c65ca Cosmetic parser change
Rename typemap_parameter_declarator as it is no longer just used for typemaps
2015-06-22 07:04:34 +01:00
William S Fulton
6890dfa881 Fix parse errors for C++11 type aliasing
Recently introduced by the fix for C++11 type aliasing seg fault - 117f6d00
2015-06-22 07:04:34 +01:00
William S Fulton
117f6d0026 Fix C++11 type aliasing seg fault.
Closes #424
2015-06-09 07:59:22 +01:00
William S Fulton
54e2317b24 Fix shared_ptr of classes with private constructors and destructors.
Usually these use a custom deleter passed to the shared_ptr.
This also fixes the "unref" feature when used on classes with private destructors.
2015-05-14 19:03:06 +01:00
Olly Betts
b19d506db7 Suppress warning 325 "Nested class not currently supported (Foo
ignored)" when Foo has already been explicitly ignored with
"%ignore".
2015-05-05 18:07:49 +12:00
William S Fulton
428b6176df Add support for friend templates, including operator overloading.
Closes #196.
2015-05-05 06:48:25 +01:00
William S Fulton
463b2a324c Cosmetic rename COPERATOR to CONVERSIONOPERATOR
Was never very obvious what C in COPERATOR was.
2015-05-01 19:26:09 +01:00
William S Fulton
fa4223e496 Fix parsing of extern "C" and typedef for example:
extern "C" typedef void (*Hook2_t)(int, const char *);
extern "C" typedef int Integer;

Closes #375
2015-04-07 21:34:23 +01:00
William S Fulton
af43f90484 Wording change for missing semicolon error 2015-01-08 23:37:52 +00:00
Olly Betts
bfa570e404 Handle "constexpr explicit" and "constexpr static" 2015-01-09 11:47:40 +13:00
Olly Betts
87bdaa3910 Allow C++11 "explicit constexpr" 2015-01-08 15:56:50 +13:00
Olly Betts
62670e756e Improve errors for missing ; and unexpected ) 2015-01-08 15:27:57 +13:00
Olly Betts
04715f74e2 Improve error message when an unknown SWIG directive is used
This previously gave the cryptic "Error: Syntax error in input(1).", but
now gives "Error: Unknown directive '%foo'."
2015-01-08 12:07:54 +13:00
Vladimir Kalinin
274977154f fix for nested template defined out of class (issue #265) 2014-11-25 19:38:37 +03:00
Vladimir Kalinin
8bc38dc007 fixes "flatnested" feature for out-of-scope defined nested classes 2014-11-04 19:30:53 +03: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
Johan Hake
de4f30bd3c Small fixes to the relative import fix.
-- Now the tests actually runs
  -- Corrected the syntax for the fix in the yacc file
2014-09-29 17:37:41 +02:00
Johan Hake
30e5a79ecb Fix bug 206 where package information for relative in single file import is not propagated correctly. 2014-08-25 10:09:12 +02:00
William S Fulton
71e72c45ed Create separate extetnd.c file for handling extensions / %extend
This is just a simple code refactor, moving and function renaming to
remove the %extend code out of the parser into its own file now
 that it isn't just used in the parser.
2014-05-21 19:16:15 +01:00
Vladimir Kalinin
2aa540b9c0 %extend for nested unnamed C structs 2014-05-14 00:51:36 +04:00
Vladimir Kalinin
55bda53145 C nested classes symbol table should be in global space 2014-05-10 22:16:26 +04:00