Commit graph

4,206 commits

Author SHA1 Message Date
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
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
a00ab42f80 Merge branch 'm7thon-issue-445-python-class-docstrings'
* m7thon-issue-445-python-class-docstrings:
  Add changes note for Python tp_doc slot and docstring
  Set class docstring in tp_doc slot for python -builtin

Conflicts:
	CHANGES.current
2015-07-18 00:14:37 +01:00
Anbiru Shouta
977240b3f4 Clearer variable name in Java director generated code
Closes #463
2015-07-17 22:34:08 +01:00
William S Fulton
64652523d5 warning fixes 2015-07-17 18:18:44 +01: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
Michael Thon
7ed63b11d7 Set class docstring in tp_doc slot for python -builtin 2015-07-09 02:05:33 +02:00
William S Fulton
3718b810c7 Don't generate constructor wrappers if a base class has a private constructor
g++-5 errors out with this now with errors such as:

default_constructor_wrap.cxx:665:27: error: use of deleted function ‘FFF::FFF()’
   result = (FFF *)new FFF();
                           ^
default_constructor_wrap.cxx:314:7: note: ‘FFF::FFF()’ is implicitly deleted because the default definition would be ill-formed:
 class FFF : public F {
       ^
default_constructor_wrap.cxx:301:4: error: ‘F::~F()’ is private
    ~F() { }
    ^
default_constructor_wrap.cxx:314:7: error: within this context
2015-07-07 20:15:55 +01:00
William S Fulton
fb2b1af2e7 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
William S Fulton
edcdaaec16 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
Nils Gladitz
925cec3a82 Add a space between literal and string macro
In C++11 a space between a literal and string macro is required.
2015-07-03 20:59:23 +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
Olly Betts
822b2355c0 Improve handling of whitespace in %pythoncode
Previously SWIG looked at the indentation of the first line and removed
that many characters from each subsequent line, regardless of what those
characters were.  This was made worse because SWIG's preprocessor removes
any whitespace before a '#'.  Fixes github issue #379, reported by Joe
Orton.
2015-06-29 22:12:38 +12:00
Simon Marchetto
b05f0057ca improve support of varargs 2015-06-23 16:24:35 +02: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
Ian Lance Taylor
11d8403c3c [Go] Fix member variables in base classes to handle CWRAP_NATURAL_VAR
correctly.  Add a test case for the problem.

Fixes #339.
2015-06-20 17:42:44 -07:00
William S Fulton
53b7659ebf Fix Python pep8 warning when using -fastinit (or -O)
Fixes: E231 missing whitespace after ','
2015-06-16 08:11:29 +01:00
William S Fulton
180e21269d Fix python -builtin -O and overloaded functions
More specifically fixes compile errors using -builtin -fastunpack -modernargs.
Recent regression (416277b). Closes #436.
2015-06-16 07:59:22 +01:00
William S Fulton
b94820adcf Fix r.cxx build break 2015-06-12 23:37:08 +01:00
William S Fulton
9b2bde403b R - Remove constantWrapper message wrapping constants
An implementation is still needed for constants.
2015-06-12 20:26:24 +01:00
William S Fulton
cc6970e21f Documentation improvements for -o and -oh options 2015-06-12 06:32:58 +01:00
William S Fulton
8bd6e596d1 Cosmetics - remove references to Java in C# module 2015-06-11 19:39:51 +01:00
William S Fulton
6ab1ab57dd Merge branch 'Sghirate-master' - C# -outfile option
* Sghirate-master:
  changes file update for -outfile
  Add in all C# command line options to the docs
  C# -outfile cosmetic code fixes
  [C#] Single file mode (fixes)
  [C#] Single file mode (minor fix)
  [C#] Single file mode

Conflicts:
	CHANGES.current
2015-06-11 07:53:30 +01:00
William S Fulton
2b9b007027 C# -outfile cosmetic code fixes 2015-06-11 07:42:50 +01:00
William S Fulton
efa84dab7c Fix warning display of types associated with 'using' and templates. 2015-06-09 07:59:49 +01:00
William S Fulton
117f6d0026 Fix C++11 type aliasing seg fault.
Closes #424
2015-06-09 07:59:22 +01:00
Frederick Parotat
b83307e354 [C#] Single file mode (fixes)
Renamed argument '-csout' to '-outfile'.
Reformatting (Tab spacing; Pointer style).
Chagned html documentation.
2015-06-04 14:15:00 +02:00
Frederick Parotat
0b09978219 [C#] Single file mode (minor fix)
Removed debug output
2015-06-03 14:26:38 +02:00
Frederick Parotat
747e22f714 [C#] Single file mode
Added "-csout <path>" parameter. If supplied all generated C# code will
be written to the given file. Makes it easier to integrate SWIG into
automated script based build processes.
2015-06-03 14:19:13 +02:00
William S Fulton
b8e1a66a38 Add new feature "python:cdefaultargs"
Controls default argument code generation to obtain the default
arguments from the C++ layer instead of the Python layer.
2015-05-28 20:11:57 +01:00
William S Fulton
986a13f1a0 Fix Python typedef bool default arguments that are not booleans.
Includes code optimisation in PYTHON::convertValue().

Closes #327
2015-05-27 20:55:56 +01:00
William S Fulton
0a70498591 Refactor PYTHON::convertValue
Remove multiple return statements for upcoming commits.
2015-05-27 08:06:23 +01:00
Ian Lance Taylor
38c7d59f81 [Go] Adjust last change to always emit a destructor. 2015-05-18 11:28:24 -07:00
Ian Lance Taylor
5bca063536 [Go] Fix bug with ignored destructor--generated code did not compile. 2015-05-18 09:53:13 -07: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
William S Fulton
775afd3579 Refactor Java director swig_override array code
Remove code duplication: Use new Swig::BoolArray to replace multiple
instances of ZeroedBoolArray.

Refactors #403 and #413.
2015-05-10 11:40:42 +01:00
Olly Betts
9086eb351c Merge pull request #413 from LindleyF/master
Don't include an STL header in SWIG.
2015-05-08 11:57:13 +12:00
Lindley French
8f19d77fec Don't include an STL header in SWIG. 2015-05-07 11:29:47 -07:00
Olly Betts
c2972b8bf0 [Python] Deal with an integer as the default value of a bool
parameter in the C++ prototype.  Fixes github #327, reported by
Greg Allen.
2015-05-07 16:25:32 +12:00
Olly Betts
8fc7796643 Merge pull request #403 from LindleyF/master
Zero-initialize swig_override in the director constructor.
2015-05-07 13:26:04 +12:00
Lindley French
159b3c7958 Use a bitset which is automatically initialized to 0, instead of a bool array which is not. 2015-05-06 11:33:28 -07: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