Create a new T_UNKNOWN type code and use this for the cases where
we previously abused T_INT. This means we can now reliably deduce
`int` when we see T_INT.
Fix the deduced result types of unary plus and unary minus which weren't
getting integer promotion applied to them.
Fix the deduced result type of the C++ logical not operator which was
`int` but should be `bool`.
when a method is declared in the class along with a
using declaration and the using declaration is declared before
the method that implemented the pure virtual method, such as:
struct ConcreteDerived : AbstractBase {
ConcreteDerived() {} // was not wrapped
using AbstractBase::f;
virtual void f(int n) override {}
};
SourceForge bug: https://sourceforge.net/p/swig/bugs/932/
check_implemented in allocate.cxx was correctly finding a
non-abstract method, however, Swig_symbol_clookup_local_check, was
using the using declaration node instead of using the node returned
by check_implemented. The checkfunc is now given more control by
returning the node to use rather than Swig_symbol_clookup_local_check
always using the head of the csym linked list.
The sym:overname attribute was not being updated when templates were
included in the list of overloaded methods/constructors, leading to
duplicate target language symbols in some language like java/csharp.
Closes#2541
Parser no longer checks for a declared constructor when handling a
using declaration in order to correct the name as it won't find
implicitly declared constructors. Now it checks that a using
declaration is for something that looks like a constructor instead
by checking the immediate base classes for allowed constructors.
This was only being used in one very specific case where we failed
to parse a type string, which seems like it really is just an
internal error so try handling it as such.
Closes: #2643
Remove warning SWIGWARN_CPP11_VARIADIC_TEMPLATE which was issued if more
than one argument was used for a variadic template.
SwigType enhancement: 'v.' now represents a variadic argument.
Further corrections to pass SwigType * to methods expecting types
instead of passing readable type strings.
Swig_string_mangle() takes a generic String *, but it was calling
functions that require SwigType *. Swig_string_mangle_type() is
now provided for SwigType *r. The special template handling
on types now occurs in this function.
Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.
Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this
Closes#1050
Resolve the return type to correctly determine if the type is a pointer or
reference to a director class.
SwigType_refptr_count_return() recently added as a simpler fix is no
longer needed.
The conventional approach of using the "type" rather than "decl" to
analyse the return type is used instead too.
Issue #1823
This OS has been unsupported for over 20 years. We stopped providing
macswig builds more than 20 years ago too:
https://sourceforge.net/projects/swig/files/macswig/
The required SIOUX library doesn't seem to be available anywhere
now either.
Closes#2323
Avoid using reserved identifiers such as `_DOHINT_H` (fixes#1989),
fix cases where the name doesn't match the filename, and make the naming
more consistent and less likely to collide with include guards in other
headers.
Exit() is a wrapper for exit() by default, but SetExitHandler() allows
specifying a function to call instead.
This means that failures within DOH (e.g. Malloc() failing due to lack
of memory) will now perform cleanup such as removing output files.
This commit also cleans up exit statuses so SWIG should now reliably
exit with status 0 if the run was successful and status 1 if there was
an error (or a warning and -Werror was in effect).
Previously in some situations SWIG would try to exit with the status set
to the number of errors encountered, but that's problematic - for
example if there were 256 errors this would result in exit status 0 on
most platforms. Also some error statuses have special meanings e.g.
those defined by <sysexits.h>.
Also SWIG/Javascript tried to exit with status -1 in a few places (which
typically results in exit status 255).
Use the "type" naming format for the types mangled by "#@" and "##@"
preprocessor operators, in order to allow customizing them for a
particular backend.
This isn't used by any backend yet, so this doesn't change anything so
far.
This involves properly counting the number of references and pointers in the return
type of a function and only generate unwrapping code if this number is 1.
For template instances some post-processing code is added to fix the 'decl' and
'type' attributes of functions if changed in an unfavorable way during template
expansion.
This commit fixes swig#1811.
This is the Doxygen work begun in Google Summer of Code projects 2008
and 2012 and subsequently improved by numerous contributors.
* vadz-doxygen: (314 commits)
Add changes entry for Doxygen support
Add some missing doctype tyemaps
Doxygen warnings cleanup
Move doxygen warning numbers
Add Python doxygen example
Doxygen example
Add Doxygen to include paths
Doxygen source rename
More merge fixes from doxygen branches
Correct python example headers
Correct source code headers
Another merge fix from doxygen branches
Java enums output format fixes
Add omitted doxygen_parsing_enums testcase
PEP8 conformance for comment verifier module
Clean up merge problem
Doxygen html tweaks
Update html chapter numbering for added Doxygen chapter
Fixes to makechap.py to detect ill-formed headers
html fixes for Doxygen
Add missing CPlusPlus17.html file
Format files to unix format
Doxygen testcase tweak to match that in the html docs
Doxygen html documentation updates and corrections
Remove doxygen Examples subdirectory
Beautify doxygen source code
Code formatting fixes in doxygen code
Remove unused doxygen code
new_node refactor
Various merge fixes in doxygen branches
Unused variable warning fix
Fix wrongly resetting indent after formulae in Doxygen comments
Add support for doxygen:alias feature
Get rid of meaningless return type of DoxygenParser methods
Return enum, not untyped int, when classifying Doxygen commands
Get rid of unnecessary "typedef enum" in C++ code
Use slash, not backslash, in "C/C++" in the documentation
Replace literal "<" with "<" in HTML documentation
Fix broken link to java.sun.com in Doxygen documentation
Fix using com.sun.tools.javadoc package under macOS
Fix error reporting for special characters in Doxygen parsing code
Switch Python Doxygen unit tests to use inspect.getdoc()
Use correct separator in Java class path under Windows.
Remove executable permission from appveyor.yml.
Use JAVA_HOME value in configure to detect Java.
Display JAVA_HOME value in "make java_version".
Fix harmless MSVC warning in DoxygenTranslator code.
Reset "_last" for all but first enum elements.
Don't duplicate Javadoc from global enum Doxygen comments twice.
Move Doxygen comments concatenation from the parser to the lexer.
Fix shift/reduce conflicts in Doxygen pre/post comment parsing.
Rewrote part of the grammar dealing with Doxygen comments for enums.
No changes, just remove spurious white space only differences.
Move Doxygen comment mangling from the parser to the lexer.
Merge "-builtin" autodoc bugs workarounds from master into test.
Quote JAVA_HOME variable value in Java test suite makefile.
Remove unused C_COMMENT_STRING terminal from the grammar.
Fix missing returns in the Doxygen test suite code.
Fix trimming whitespace from Doxygen comments.
Remove code not doing anything from PyDocConverter.
Remove unused <sstream> header.
Remove unreferenced struct declaration.
Remove unused Swig_warn() function.
Remove any whitespace before ignored Doxygen commands.
Remove trailing space from one of Doxygen tests.
Fix autodoc strings generated in Python builtin case and the test.
Fix Doxygen unit test in Python "-builtin" case.
Use class docstrings in "-builtin" Python case.
Don't indent Doxygen doc strings in generated Python code.
Add a possibility to flexibly ignore custom Doxygen tags.
Stop completely ignoring many Doxygen comments.
Fix structural Doxygen comment recognition in the parser.
No changes, just make checking for Doxygen structural tags more sane.
Use "//", not "#", for comments in SWIG input.
Allow upper case letters and digits in Doxygen words.
Pass the node the Doxygen comment is attached to to DoxygenParser.
Get rid of findCommand() which duplicaed commandBelongs().
Recognize unknown Doxygen tags correctly.
No real changes, just pass original command to commandBelongs().
Describe Doxygen-specific %features in a single place.
Give warnings for unknown Doxygen commands in Doxygen parser.
Document the return type when translating Doxygen @return to Python.
Fix translated Doxygen comments for overloaded functions in Python.
Also merge Doxygen comments for overloaded constructors in Python.
Allow using enum elements as default values for Python functions.
Don't always use "*args" for all Python wrapper functions.
No real changes, just make PYTHON::check_kwargs() const.
Refactor: move makeParameterName() to common Language base class.
Remove long line wrapping from Python parameter list generation code.
Simplify and make more efficient building Python docstrings.
Translate Doxygen code blocks to Sphinx code blocks.
Add a simple test of multiple parameters to Doxygen test suite.
Make Python parameters types hyperlinks in the doc strings.
Make Language::classLookup() and enumLookup() static.
Fix arguments of @param, @return etc translations to Python.
Remove unused method from PyDocConverter.
No real changes, just remove an unnecessary variable.
Preserve relative indentation when parsing Doxygen comments.
Use Sphinx-friendly formatting for overloaded functions documentation.
Add poor man trailing white space detection to Doxygen Python tests.
...
Internally, handle function ref-qualifiers in the function decl type string.
Needed for a whole host of things to work like %feature and %rename.
Add %feature %rename and %ignore testing for ref-qualifiers.
The scoping rules around %template have been specified and enforced.
The %template directive for a class template is the equivalent to an
explicit instantiation of a C++ class template. The scope for a valid
%template instantiation is now the same as the scope required for a
valid explicit instantiation of a C++ template. A definition of the
template for the explicit instantiation must be in scope where the
instantiation is declared and must not be enclosed within a different
namespace.
For example, a few %template and explicit instantiations of std::vector
are shown below:
// valid
namespace std {
%template(vin) vector<int>;
template class vector<int>;
}
// valid
using namespace std;
%template(vin) vector<int>;
template class vector<int>;
// valid
using std::vector;
%template(vin) vector<int>;
template class vector<int>;
// ill-formed
namespace unrelated {
using std::vector;
%template(vin) vector<int>;
template class vector<int>;
}
// ill-formed
namespace unrelated {
using namespace std;
%template(vin) vector<int>;
template class vector<int>;
}
// ill-formed
namespace unrelated {
namespace std {
%template(vin) vector<int>;
template class vector<int>;
}
}
// ill-formed
namespace unrelated {
%template(vin) std::vector<int>;
template class std::vector<int>;
}
When the scope is incorrect, an error now occurs such as:
cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and
was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
Previously SWIG accepted the ill-formed examples above but this led to
numerous subtle template scope problems especially in the presence of
using declarations and using directives as well as with %feature and %typemap.
Actually, a valid instantiation is one which conforms to the C++03
standard as C++11 made a change to disallow using declarations and
using directives to find a template.
// valid C++03, ill-formed C++11
using std::vector;
template class vector<int>;
Similar fixes for defining classes using forward class references have
also been put in place. For example:
namespace Space1 {
struct A;
}
namespace Space2 {
struct Space1::A {
void x();
}
}
will now error out with:
cpp_class_definition.i:5: Error: 'Space1::A' resolves to 'Space1::A' and
was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
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.
The functions Swig_typemap_new_scope() and Swig_typemap_pop_scope() introduced
by 503746e964 back in 2000 were never used and
ended up being commented out themselves, but support for typemap scopes still
remain in several other functions. Remove it completely to make the code
simpler without any ill effects.
Update Doxygen-specific Python unit tests to work with the new indentation.
Update one of Doxygen-specific Java tests to still build with the new handling
of srcdir.
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.