Allow skipping creating C++ wrappers with cxxignore feature

This can be useful to avoid errors due to features not supported at C++
level in some tests.
This commit is contained in:
Vadim Zeitlin 2021-12-09 00:36:09 +01:00
commit e15d3e17ac
2 changed files with 12 additions and 1 deletions

View file

@ -706,7 +706,7 @@ Other ones are due to things that could be supported but haven't been implemente
</ul>
</p>
<H3>36.6.1 Additional sections</H3>
<H3>36.6.1 Additional customization possibilities</H3>
Generated C++ code can be customized by inserting custom code in the following sections:
@ -715,6 +715,11 @@ Generated C++ code can be customized by inserting custom code in the following s
<li><tt>cxxcode</tt> for additional code to appear after the declarations of all wrapper classes, inside the module-specific namespace.</li>
</ul>
The following features are taken into account when generating C++ wrappers:
<ul>
<li><tt>cxxignore</tt> May be set to skip generation of C++ wrappers for the given function or class, while still generating C wrappers for them.</li>
</ul>
<H3>36.6.2 Exception handling</H3>
<p>

View file

@ -828,6 +828,9 @@ public:
except_check_start =
except_check_end = "";
if (Checkattr(n, "feature:cxxignore", "1"))
return;
// Usually generating wrappers for overloaded methods is fine, but sometimes their types can clash after applying typemaps and in this case we have no
// choice but to avoid generating them, as otherwise we'd just generate uncompilable code.
if (Getattr(n, "sym:overloaded")) {
@ -980,6 +983,9 @@ public:
if (!cxx_wrappers_.is_initialized())
return;
if (Checkattr(n, "feature:cxxignore", "1"))
return;
String* const classname = Getattr(n, "sym:name");
scoped_dohptr base_classes(NewStringEmpty());