Commit graph

5,195 commits

Author SHA1 Message Date
John McFarland
f8ed9d71a7 Fix doxygen translation of \p command for python
Doxygen writes this using typewriter font, so wrap in `` for python
2019-09-15 10:59:03 -05:00
John McFarland
c11172587c Fix doxygen handling of \em tag for python
In doxygen, \em is used for italics, so it should be wrapped in "*".
2019-09-15 10:59:03 -05:00
John McFarland
08ff05c14c Add doxygen_code_blocks_runme.java
The code blocks test is intended to test code block language options
and python doctest translation that is supported for Python, but the
doxygen constructs are still recognized when translating comments for
Java (it is just that the code language option is not used).
2019-08-21 08:43:12 -05:00
John McFarland
4a5a86ba91 Special handling for python doctest code blocks
A doctest code block begins with ">>>" and is not indented.  Identify
these in doxygen comments and treat them accordingly.  Also add check
to padCodeAndVerbatimBlocks for these because Sphinx requires an empty
line before.

Add test case to doxygen_code_blocks.i.
2019-08-07 17:04:12 -05:00
John McFarland
5230afb3e1 Add new doxygen test doxygen_code_blocks
This does somewhat more detailed testing of the code block parsing,
and also exercises the language identification of python doctest
features.  For now, it is only tested by python (javadoc translation
may not correctly handle some of the characters that are used here).
2019-08-07 16:55:38 -05:00
John McFarland
fd33bdf8a5 Flag optional arguments in doxygen pydoc output
If the parameter has a default value, add the string ", optional" to
the parameter type description in the translated python comments.
Three examples with default values were already present in the test
cases, so their expected python output has been updated accordingly.
2019-08-07 16:42:39 -05:00
John McFarland
36f0e9919f Add parameter direction to doxygen pydoc output
For doxygen comments that specify parameter direction (i.e.,
\param[in], \param[out], and \param[in,out]), the direction is
appended to the type definition in the generated Python documentation.

Updated expected python output for doxygen test case.
2019-08-07 16:42:39 -05:00
John McFarland
eb11c025c7 Support doxygen \param[] commands
Recognize \param[in], \param[out], and \param[in,out].  Currently they
are all treated the same as \param, but the information is now
available for inclusion in the translated comments.  This is done
using new utility functions getBaseCommand and getEndOfWordCommand,
which will also generalize to treatment of code command options,
e.g. \code{.py}.  Preliminary treatment of the extended version of
\code is already in place in these functions.

Added examples of all three new \param commands to the
doxygen_translate_all_tags test and updated the python and java
expected output.
2019-08-07 16:42:24 -05:00
William S Fulton
3cc4b21163 Parameter name expansion fix for template functions.
Fix regression in 4.0.0 where a template function containing a parameter
with the same name as the function name led to the parameter name used in the
target language being incorrectly modified.

Closes #1602
2019-08-01 19:46:16 +01:00
William S Fulton
0d76eb3b56 The errors testcases use -module to obtain a unique module name
Fixes parallel make where each invocation of swig was writing and
deleting the same file resulting in lots of the newly introduced
warning messages:

  On exit, could not delete file xxx.py: No such file or directory
2019-07-31 00:08:49 +01:00
William S Fulton
15a0681b11 Add note about wchar_t marshalling fix required for Windows 2019-07-25 18:57:10 +01:00
William S Fulton
c7aae28a99 Remove failing wchar c# test 2019-07-24 08:35:13 +01:00
William S Fulton
55b5552a6a More C# wstring testing 2019-07-23 19:57:06 +01:00
William S Fulton
2d36b3468a More C# wstring testing 2019-07-23 19:41:25 +01:00
William S Fulton
eb6efdb60b C# wstring testing
Test code from issue #1530
2019-07-23 19:10:35 +01:00
William S Fulton
a9a7b03ba6 Split testcases li_std_wstring.i and li_std_wstring_inherit.i
Not many languages have support for std_wstring.i, so disable testing
for these languages until added.
2019-07-22 19:05:21 +01:00
William S Fulton
5131096b80 li_std_wstring test rename to li_std_wstring_inherit
This testcase was only run in Ruby and Python and implements an
obscure feature where a C++ class inherits from a std::wstring.

The li_std_wstring test is left in place to be modified in next commit
for more regular wstring testing across all languages.
2019-07-18 19:49:50 +01:00
William S Fulton
c8b1eed8ce Merge branch 'annotation_quoting'
* annotation_quoting:
  Examples: Unify string quoting in the Python sources
  Test-suite: Unify string quoting in the Python sources
  Tools: Unify string quoting in the Python sources
  Generator: Unify string quoting in generated Python sources
  Generator: Remove trailing whitespaces in the Python module
2019-07-18 07:23:06 +01:00
William S Fulton
53b425b638 Merge branch 'bugfix/616-csharp-bool-array'
* bugfix/616-csharp-bool-array:
  Add changes entry to fix C# bool[]
  Quieten failing bool[] testcase message
  Skip failing bool[] test cases when running under mono
  Change C# bool[] typemaps to marshall as 1-byte
2019-07-16 19:51:32 +01:00
William S Fulton
fc9c37192b Quieten failing bool[] testcase message 2019-07-16 19:46:32 +01:00
Gareth Francis
15ad67c37f Skip failing bool[] test cases when running under mono 2019-07-15 16:08:31 +01:00
Dmitry D. Chernov
f88ba7c182 Examples: Unify string quoting in the Python sources 2019-07-14 14:12:23 +10:00
Dmitry D. Chernov
fa5f519bf9 Test-suite: Unify string quoting in the Python sources 2019-07-14 12:58:21 +10:00
William S Fulton
1e11085d5f Fix testcase warning for languages that don't fully support nested classes 2019-07-12 08:26:26 +01:00
William S Fulton
1e66c13abd Merge branch 'csharp-set-fixes'
* csharp-set-fixes:
  Fix std::vector<> Java typemaps for primitive types
  Allow std::set<> C# typemaps to work for non-nullable types too
  Replace leftover string with the proper type in C# set typemap
2019-07-12 08:13:19 +01:00
Vadim Zeitlin
c321aca2b4 Fix missing value for first item of enums with trailing comma
The value of the first item of an enum with a trailing comma after its
last item was not correctly initialized to 0 any more after the changes
of 74adaa5738 (see #1515) because "_last"
attribute was not set correctly in this case.

Do set it for the last item when it's followed by a comma too and add
more unit tests checking for this.

Closes #1566.
2019-07-11 17:15:38 +02:00
Vadim Zeitlin
2be293a647 Fix std::vector<> Java typemaps for primitive types
For such types, the generated proxy class inherited from
java.util.AbstractSet<BoxedType<T>> (where BoxedType<T> is "Integer",
for example, when T is "int"), but defined an overloaded add() taking T,
instead of overriding the base class virtual add() taking BoxedType<T>,
resulting in an exception being thrown whenever add() was called during
run-time.

Extend Java unit test to bring it to parity with C# one added in the
previous commit.

See #1568.
2019-07-11 13:10:23 +02:00
Vadim Zeitlin
28c6140c56 Allow std::set<> C# typemaps to work for non-nullable types too
Notably make them work for primitive types, such as "int".

Doing this requires using "object" instead of the actual C# type of the
variable to store the current value in the iterator, as we don't
currently have a "csnullabletype" typemap that would expand to "T" for
nullable types and "T?" for the other ones. This is a bit ugly, but it
shouldn't matter much for the generated code and is already done in
std::vector<> typemaps.

Also add a simple unit test verifying the basic functionality for such
vectors.

Closes #1568.
2019-07-11 13:09:46 +02:00
Vadim Zeitlin
53d75dc133 Replace leftover string with the proper type in C# set typemap
This is just a mistake remaining from generalizing the old
string-specific typemap to any type.

Fix it now and update a unit test to test for sets of objects other than
strings.
2019-07-11 12:49:17 +02:00
William S Fulton
42f5e2da41 Merge branch 'doxy/segfault'
* doxy/segfault:
  Add iterator safety check in DoxygenParser::parse
  Doxygen comment parsing fix for empty lines in code/verbatim blocks
2019-07-11 07:08:51 +01:00
William S Fulton
aea7a6d30f Merge branch 'patch-1'
* patch-1:
  nested_inheritance_interface testcase enhancement
  Add nested_inheritance_interface test for csharp
  Fix class name for nested classes
  Add nested_inheritance_interface test
  Fix class name for nested classes

Conflicts:
	CHANGES.current
2019-07-09 19:37:35 +01:00
William S Fulton
20d96531e3 nested_inheritance_interface testcase enhancement
Fixes unused variable reported by C# compiler and enhance test slightly
2019-07-09 19:36:46 +01:00
William S Fulton
35e24ebd66 Testcase warning fix for gcc-9
warning: returning reference to temporary [-Wreturn-local-addr]
2019-07-09 08:12:05 +01:00
William S Fulton
75c5cb7458 gcc-9 testcase warning fix
warning: ‘new’ of initializer_list does not extend the lifetime of the
underlying array [-Winit-list-lifetime]
2019-07-09 08:06:18 +01:00
Isaac Pascual Monells
f1f98348b4 Add nested_inheritance_interface test for csharp 2019-07-08 12:49:28 +02:00
John McFarland
85a4c7ffc0 Doxygen comment parsing fix for empty lines in code/verbatim blocks
Fix how end of paragraph is identified when parsing \code and
\verbatim blocks that appear within a paragraph and contain an empty
line.  Previously this would generate a warning for unexpected end of
doxygen comments, and it could generate a segfault due to
dereferencing an invalid iterator value.

The doxygen_basic_translate.i and doxygen_basic_translate_style2.i
tests have been updated to serve as regression tests for this
behavior.  Prior to this fix, inclusion of the empty code block line
in this context produced a segfault.
2019-07-06 11:30:46 -05:00
Gareth Francis
58863bba59 Change C# bool[] typemaps to marshall as 1-byte
Default marshalling for bool[] now uses 1-byte entries in the array, to
ensure array contents is as expected in C++.

When running under mono csharp_lib_arrays_bool testcase will fail
due to an apparent bug in mono. Works correctly under Microsoft's
runtime. See https://github.com/mono/mono/issues/15592
2019-07-06 12:56:27 +01:00
Isaac Pascual Monells
84e310402a Add nested_inheritance_interface test 2019-07-02 12:57:16 +02:00
William S Fulton
1204297a1b Merge branch 'doxy/space'
* doxy/space:
  Ensure empty line before code and math blocks in doxygen pydoc
  Remove extra newline before code block in doxygen python output
  Clarify python doxygen code block indentation handling
  Cleanup of pydoc translator newline trimming
  Correction to recently added doxygen python test case
  Adjust expected python output for doxygen style2 test
  Adding test for second doxygen comment style
  Fix bug in doxygen python code block indent
  Eliminate extra newlines around doxygen python block math
  Eliminate extra newlines in doxygen python \verbatim blocks
  Remove extra newline from end of doxygen python \code command
  Remove extra newline in beginning of doxygen python \code command
  Fix python doxygen indentation for inline \code command
2019-06-28 19:50:39 +01:00
William S Fulton
06e5ab8975 Workaround clang 10.0.1 C++17 linker errors in testcases
Fixes:
  Undefined symbols for architecture x86_64: "___cxa_deleted_virtual"
which clang issues when a class deletes a method (seems to be when the
function is not one of the compiler's automatically added special member
functions).
2019-06-27 07:40:49 +01:00
William S Fulton
d6ef118219 std::auto_ptr replacement for testing with C++17 and later
Keep suppressing deprecated warnings for C++11 and C++14
2019-06-27 07:40:49 +01:00
William S Fulton
f3357f1f57 Remove use of std::bind2nd which is removed in C++17 2019-06-27 07:40:49 +01:00
William S Fulton
c8cef5c2f2 Fix constexpr-not-const clang warning in testcase
'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Werror,-Wconstexpr-not-const]
2019-06-27 07:40:49 +01:00
William S Fulton
3045ba3532 Warning suppression on testcase using clang 2019-06-27 07:40:49 +01:00
William S Fulton
116b6b1028 Remove deprecated calls in Octave testcases
Fixes warning using Octave 5.1:
  warning: findstr is obsolete; use strfind instead
2019-06-27 07:40:49 +01:00
John McFarland
daad5d664d Ensure empty line before code and math blocks in doxygen pydoc
Sphinx requires an empty line before code and math blocks, whereas
doxygen does not.  This update ensures that a blank line is included
before generated code and math blocks in the pydoc output.  This is
done by post-processing the docstring line by line to check whether
any newlines need to be added.  This way, if the original doxygen
source already includes an empty line before a block, an additional
unnecessary empty line is not added.

Updating the expected test output for doxygen_basic_translate, which
now adds the necessary empty line before the code block.  Adding
further test cases to doxygen_translate_all_tags to explicitly verify
that a newline is added in the pydoc output before both code and math
blocks that appear within a paragraph.

Additionally, empty lines previously appearing at the beginning of the
generated docstrings are now removed.  This does not alter the
behavior of the tests.
2019-06-18 17:12:08 -05:00
William S Fulton
d9cac176f6 Suppress testcase clang warning for auto_ptr deprecation 2019-06-06 19:52:37 +01:00
William S Fulton
7231c2a065 Fix cpp11_rvalue_refrence3 testcase clang warning
cpp11_rvalue_reference3_wrap.cxx:256:38: warning: binding reference member 'member_rvalue_ref_ptr1' to
      a temporary value [-Wdangling-field]
  Thing *&& member_rvalue_ref_ptr1 = 0;
                                     ^
2019-06-06 19:45:24 +01:00
Brad Kotsopoulos
55e835e0ae Java std::vector constructor performance improvement
Reserve before loop of push_back
Refactor li_std_vector testcase

This is a squash merge of #1552
2019-06-06 19:29:11 +01:00
luz.paz
87695dacb1 Misc. documentation and source comment typo fixes
Found via `codespell -q 3 -L uint,od,objext,ba,cmo,bae,ans,struc,fo,clos,goin,upto,thru`
Revert changes in previous commit
2019-05-28 11:41:22 +12:00