Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C ci test #3

Draft
wants to merge 579 commits into
base: master
Choose a base branch
from
Draft

C ci test #3

wants to merge 579 commits into from

Conversation

vadz
Copy link
Owner

@vadz vadz commented Jun 16, 2024

No description provided.

vadz added 30 commits August 4, 2019 17:09
Don't generate "enum foo" in the function names, which obviously can't
contain spaces.

This allows another unit test to pass.
This ensures that these operators are actually wrapped, instead of just
being ignored with warnings.
Just include the header declaring it in the test code.
Handle char constants defined using #define or %constant correctly.

Also handle static member const variables, which didn't work at all
before, and quote values of such variables of char type.
This is done not so much to fix the memory leak per se (as there are
gazillions of other ones remaining), but to show that the return value
of getProxyName() does need to be freed, as this was unclear previously,
with it being freed in one place where this function was used, but not
in the other one, here.

Also state this explicitly in the function comment.
It doesn't seem necessary to muck with sym:name explicitly when we
construct the fully qualified name using getNamespacedName() later
anyhow.

Moreover, the overridden version had a bug which resulted in a crash in
template_empty_inherit unit test and simply removing it entirely allows
the test to pass (without breaking anything else).
There doesn't seem to be any unit tests covering this, but the old code
was wrong because it didn't replace periods used as namespace separators
with underscores, which resulted in periods appearing in the output when
nested namespace were used.

Fix this and also reuse the now fixed getNamespacedName() in
getEnumName() which contained its own buggy version of the same code.
This is not really useful, but gets rid of an annoying warning when
running li_constraints.ctest unit test.
Not being able to do it is too restrictive in practice and just forces
to use raw DOH pointers, which is not really less dangerous than adding
the assignment operator and reset() method to this class.
Prefix them with namespace-based prefix (e.g. "ns1_ns2_" for a function
inside ns1::ns2) if feature:nspace is on. Otherwise, or if the function
is defined in the global namespace, use the module name as prefix
instead of "_wrap": this is slightly less ugly and results in more
unique names.
This is going to be used for the upcoming shared_ptr<> support.
Use "..." instead of "{...}" to avoid generating extra lines with
opening/closing curly braces, which are completely unnecessary.

Also remove an unnecessary "if" check in "in" typemap, which was
useless.

No real changes.
Remove the code related to "_result_ref" which was confusing and plain
wrong, as it generated something that compiled but crashed during
run-time due to the use of a pointer to an already destroyed stack
object.

Instead, correct the "out" typemap to create a new copy of the object,
which mostly works fine on its own, except that it depends on using
SwigValueWrapper if necessary, so add the call to cplus_value_type()
does this. This also required removing the code resolving typedefs in
the "type" attribute because it confused the base class logic and still
needs an explicit cast to the actual return type due to the use of (and
probable bug in) get_wrapper_func_return_type().

These changes mean that "cppouttype" typemap is not used any longer, so
remove it too.

A couple more tests pass now.
Avoid warnings about implicitly-declared strcmp().
The tests still passed, but with warnings during compilation.
Allow having the list of failing C++11 tests in the common makefile.
The existing typemaps didn't work at all and making them work would
require defining all the typemaps needed by the Unified Typemaps
Library, which seems to be geared towards dynamic languages.

Just implement completely straightforward (and not very convenient to
use) typemaps instead.

Enable the now passing unit tests and add a runme for one of them.
Merge with the latest master before making more changes.
They were not supported currently, but processing them resulted in just
a warning about missing ctype typemap and generated uncompilable code.

Give an error and don't generate any code at all now, which is more
clear and helpful.

Also exclude the part of kwargs_feature test using varargs from C test
suite.
Instead of skipping it entirely, just disable the part using member
function pointers, which are not supported in C backend.
These warnings are perhaps useful for the SWIG end users, but not really
in the CI build logs, where they just create noise and are distracting.
There doesn't seem to be any reason for using it rather than just
returning from main() as usual, and it provokes warnings about
implicitly declared function when compiling them.
Use "%zd" for printing size_t values rather than "%d".
This is needed to find the SWIG-generated shared library when using C
too, as it's already the case for many (but, surprisingly, not all)
other target languages.
This fixes a check-maintainer-clean problem.
The test is trivial, but still better than nothing.
Use simple fixed typemap instead of trying to use the much more complex
one from the UTL which doesn't work for C.

Add a simple test case for std::map<>.
This is similar to the previous commit for std::map<>.
This is used in some exception-related typemaps, both in SWIG itself
(although they're not used with C backend currently) and outside of it.
wsfulton and others added 30 commits June 1, 2024 13:45
* nspacemove:
  Improved namespace validity checks for the nspace feature
  Add docs for %nspacemove
  Add nspacemove example for STL types
  Validate scopename in nspace feature
  Fix %nspace and %nspacemove for nested classes and enums in a class
  Enhance %nspace with %nspacemove for moving symbols into a different target language namespace
  nspacemove testcase
  Correct code in javascript testcase for jsc

Conflicts:
	CHANGES.current
"feature" prefixes are reserved for real SWIG features and are not
used for internal flags on a node.
* fix_2872:
  Rename internal flag to fvirtual:ignore
  Whitespace corrections
  Adding virtual destructors.
  Adding test case for swig#2872.
  add_member_for_using_declaration now ignore's the feature:ignore flag if it was set by fvirtual. This fixes swig#2872.

Conflicts:
	CHANGES.current

Closes swig#2872
Closes swig#2873
Support parsing `sizeof(X)` for any expression or type X by skipping
balanced parentheses.  We don't need to actually parse X since the type
of sizeof is always size_t.

Fixes swig#2919
I seem to have managed to miss a few cases in
393de5b.  The only remaining
\$[0-9] matches in parser.y now are in comments talking about a SWIG
feature with this syntax.
Here X can only be an identifier.
Support alignof(T) for arbitrary type T, and deduce the type of
alignof(T) as size_t.
 into C# class named SWIGStringWithLengthHelper.

Signed-off-by: Erez Geva <[email protected]>
And `typemaps/cdata.swg` to `typemaps/cdata.swg`.
Move `cdata_apply.swg` content to `typemaps/cdata.swg`.

Signed-off-by: Erez Geva <[email protected]>
The cdata.i docs in C#, Java, D, Go had a confusing mix of target language
and C declarations. Improve the main cdata documentation in Library.html instead.
csharphead.swg is where all the other imclasscode lives
* char_binary_java_fix-tidyup:
  Move SWIGStringWithLengthHelper to csharphead.swg
  cdata whitespace/cosmetic fixups
  cdata doc updates
  Rename `typemaps/cdata_struct.swg` to `typemaps/cdata_begin.swg`. And `typemaps/cdata.swg` to `typemaps/cdata.swg`. Move `cdata_apply.swg` content to `typemaps/cdata.swg`.
  Group the C# marshalling of STRING-LENGTH typemap  into C# class named SWIGStringWithLengthHelper.
  Leave Length & string reverse order typemap in typemaps/strings.swg
  Support old C# as "LPUTF8Str" was add in 2017.
  Improve documentation. Follow @wsfulton reviews.
  Use a dummy for MzScheme and untested OCaml cdate. To prevent compilation error.
  Further fixing follow reviews.
  Reorganise raw data typemap,  so typemaps folder contain only common part. Improve document.
  Inline SWIG_string_to_utf8_bytes SWIG_utf8_bytes_to_string code
  Fixes of STRING/BYTES LENGTH typemaps.

 Conflicts:
	CHANGES.current
Null pointers returned from functions also using output parameters or C
strings typemaps were lost because the generated code didn't distinguish
between Py_None corresponding to them and Py_None indicating the return
value of a "void" function.

This doesn't seem to be easy to solve properly because the function
return type and output parameters typemaps are independent and there is
no way to customize the behaviour of the latter depending on the former.

So we do it using a hack involving a global variable which is always 0
and is passed to SWIG_Python_AppendOutput() from non-void functions, but
is shadowed by a local variable with the same name set to 1 in the void
ones. This allows us to only discard Py_None if it corresponds to a void
function return value.

This is obviously ugly, but requires only minimal changes, doesn't
impose much extra run-time overhead and is MT-safe (unlike any solution
involving changing global variables).

Also add a unit test checking for this for Python and for JS, where the
same function already worked correctly (unlike in some other languages,
including at least Ruby and PHP).

Closes swig#2905.
Add in $isvoid special variable which expands to 1 if the
wrapped function has a void return, 0 otherwise.
The $isvoid special variable expands to 1 if the
wrapped function has a void return, otherwise expands to 0.

In the implementation, use a consistent variable name, returntype,
for a node's "type" attribute.

Issue swig#2907
Use SWIG_Python_AppendOutput instead of t_output_helper.
This macro needs to be defined correctly under Windows too to actually
export the symbols there and it must be used in SWIG_CException_Raise()
declaration to avoid errors about DLL visibility mismatch when it's used
in its definition later.

Finally, don't handle Apple systems the same as Microsoft ones, they
should be using ELF visibility just as everyone else.
Perform only minimum conflict resolution, C backend tests don't pass
yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants