Commit graph

459 commits

Author SHA1 Message Date
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
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
Vadim Zeitlin
68492869fd Reset "_last" for all but first enum elements.
There is an implicit assumption (see TypePass::enumvalueDeclaration()) that
only the first enum element has a non-null "_last" attribute, but this was
broken by the latest enum-related grammar changes as the second enum element
also had "_last" set, coming from the new "enumlist_tail" production. This
resulted in wrong values being used for the second (only) element.

Fix this by explicitly resetting "_last" of enumlist_tail to NULL when
building the semantic value associated with it.
2015-07-27 04:25:48 +02:00
Vadim Zeitlin
4884f8cb3c Move Doxygen comments concatenation from the parser to the lexer.
This allows to write the grammar in a simpler way without running into
shift/reduce conflicts all the time because a Doxygen post comment can often
be either reduced with the preceding token or shifted if there is another
Doxygen post comment after it.

Just take care of concatenating the comments in the lexer, which makes it
handling of comment tokens slightly more complex as it now needs to look ahead
at the next tokens, but it's worse the simplifications in the parser.

No changes in behaviour.
2015-07-27 01:14:48 +02:00
Vadim Zeitlin
864945ba2e Fix shift/reduce conflicts in Doxygen pre/post comment parsing.
Don't accept both pre- and post-comments for the same declaration (a function
parameter or a class member), this didn't work before neither as the
pre-comment overrode the post-one due to the default shift/reduce resolution
preferring to shift, but it happened silently whereas now it will result in a
parse error.

In the future we could complicate the grammar to detect this and give a
warning about one of the comments being ignored instead, but for now keep
things simple.
2015-07-27 01:14:47 +02:00
Vadim Zeitlin
bc2ee1b130 Rewrote part of the grammar dealing with Doxygen comments for enums.
This brings down the number of yacc shift/reduce conflicts from 16 to 8 and
eliminates all 4 of the previously existing reduce/reduce conflicts.
2015-07-27 01:14:47 +02:00
Vadim Zeitlin
9ab3f2e232 No changes, just remove spurious white space only differences.
Whitespace-only changes to decrease the diff with master.
2015-07-25 18:37:03 +02:00
Vadim Zeitlin
dc9cecb943 Move Doxygen comment mangling from the parser to the lexer.
This is a more logical place to do this and it also simplifies the parser
code, e.g. the parser doesn't get the ignored (called "structural" for some
reason in the code) Doxygen comments from the lexer at all any more instead of
having to ignore them on its own. It also allows to define doxygen_comment and
doxygen_post_comment rules in a simpler way and avoid shift/reduce conflicts
for the sequences of Doxygen [post] comments by specifying their associativity.

In principle, the lexer could also take care of concatenating the subsequent
Doxygen comments in a single one, as this would also seem to belong to it
rather than the parser, but this doesn't seem to provide any immediate gains
and so isn't done by this commit.
2015-07-25 18:37:03 +02: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
Vadim Zeitlin
751dbf2bb7 Remove unused C_COMMENT_STRING terminal from the grammar.
This was a leftover from the initial Doxygen GSoC work in 2008 and should have
been removed by 4951d4a900 (GSoC 2012).
2015-07-20 01:03:10 +02:00
Vadim Zeitlin
302955a152 Another merge with master.
Updated Doxygen error numbers yet again, as Python errors got added in the
meanwhile, pushing the Doxygen ones further off.

And re-merged PEP8/whitespace-related conflicts in autodoc_runme.py once again
(if anybody is looking for a motivating example about why significant
whitespace is bad, here is a great use case).
2015-07-20 00:44:26 +02: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
Vadim Zeitlin
56a6f296b8 Remove unreferenced struct declaration.
This was introduced by 774cbc3ef2, apparently
accidentally.
2015-02-16 23:51:57 +01:00
Vadim Zeitlin
300ccce46c Another merge with master.
Change Doxygen error codes to start at 740 instead of at 720 as the latter was
taken by Scilab in the meanwhile.

Resolve conflicts in autodoc_runme.py once again.
2015-02-16 23:46:39 +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
Vadim Zeitlin
9b857e6cf1 Merge latest master into doxygen branch. 2014-12-15 02:55:26 +01: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
Vadim Zeitlin
cd1f4619d2 Stop completely ignoring many Doxygen comments.
For some reason, Doxygen comments such as @class or @enum were considered to
be "structural" (whatever this means) and completely removed during the
parsing time. This is wrong as such comments can be attached to their
corresponding declarations and while it would be arguably better to check that
this is indeed the case (e.g. "@class Foo" really appears before or after the
declaration of this class), throwing them away is definitely not the right
thing to do and keeping them without any further checks is a better alternative.
2014-09-10 21:55:41 +02:00