Merge branch 'wkalinin-duplicate-unions'
* wkalinin-duplicate-unions: Add testcase for nested C struct name conflict Nested structures in "C" mode symbol table fix
This commit is contained in:
commit
3baf6e9f97
4 changed files with 71 additions and 1 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.0.0 (in progress)
|
||||
===========================
|
||||
|
||||
2018-08-20: wkalinin
|
||||
#1305 Fix nested structure symbol tables in C mode to fix member name conflicts
|
||||
in different structs with the same nested struct member name.
|
||||
|
||||
2018-08-18: wsfulton
|
||||
[Python] #688 Fix makefile recursion when running python test-suite.
|
||||
|
||||
|
|
@ -19,7 +23,6 @@ Version 4.0.0 (in progress)
|
|||
implementation which uses PyInstanceMethod_New.
|
||||
|
||||
The new approach runs slightly faster. See #1310.
|
||||
|
||||
2018-08-12: gmazzamuto
|
||||
[Python] #1283 Update pybuffer.i library to use new-style Python buffer C API.
|
||||
|
||||
|
|
|
|||
|
|
@ -114,4 +114,50 @@ typedef struct OutSt {
|
|||
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
typedef struct {
|
||||
union x_union {
|
||||
int x;
|
||||
} duplicate_p;
|
||||
} x_t;
|
||||
|
||||
typedef struct {
|
||||
union y_union {
|
||||
int y;
|
||||
} duplicate_p;
|
||||
} y_t;
|
||||
|
||||
typedef struct A {
|
||||
union a_union {
|
||||
int a;
|
||||
} duplicate_p;
|
||||
} a_t;
|
||||
|
||||
typedef struct B {
|
||||
union b_union {
|
||||
int b;
|
||||
} duplicate_p;
|
||||
} b_t;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
int c;
|
||||
} duplicate_p;
|
||||
} c_t;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
int d;
|
||||
} duplicate_p;
|
||||
} d_t;
|
||||
|
||||
void set_union_values(int startval, x_t *x, y_t *y, a_t *a, b_t *b, c_t *c, d_t *d) {
|
||||
x->duplicate_p.x = startval++;
|
||||
y->duplicate_p.y = startval++;
|
||||
a->duplicate_p.a = startval++;
|
||||
b->duplicate_p.b = startval++;
|
||||
c->duplicate_p.c = startval++;
|
||||
d->duplicate_p.d = startval++;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
20
Examples/test-suite/python/nested_runme.py
Normal file
20
Examples/test-suite/python/nested_runme.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from nested import *
|
||||
|
||||
def check(a, b):
|
||||
if a != b:
|
||||
raise RuntimeError("Problem: {} != {}".format(a, b))
|
||||
xx = x_t()
|
||||
yy = y_t()
|
||||
aa = a_t()
|
||||
bb = b_t()
|
||||
cc = c_t()
|
||||
dd = d_t()
|
||||
|
||||
set_union_values(100, xx, yy, aa, bb, cc, dd)
|
||||
|
||||
check(xx.duplicate_p.x, 100)
|
||||
check(yy.duplicate_p.y, 101)
|
||||
check(aa.duplicate_p.a, 102)
|
||||
check(bb.duplicate_p.b, 103)
|
||||
check(cc.duplicate_p.c, 104)
|
||||
check(dd.duplicate_p.d, 105)
|
||||
|
|
@ -3862,6 +3862,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
|||
while (Getattr(outer, "nested:outer"))
|
||||
outer = Getattr(outer, "nested:outer");
|
||||
appendSibling(outer, $$);
|
||||
Swig_symbol_setscope(cscope); /* declaration goes in the parent scope */
|
||||
add_symbols($9);
|
||||
set_scope_to_global();
|
||||
Delete(Namespaceprefix);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue