Merge branch 'using-declarations' into upstream-master
* using-declarations: Typo fixes Fix warning suppression for WARN_PARSE_USING_UNDEF Using declarations fix in symbol tables Revert recent using-declarations code changes Conflicts: CHANGES.current
This commit is contained in:
commit
d2e9b80be3
6 changed files with 27 additions and 48 deletions
|
|
@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.1.0 (in progress)
|
Version 4.1.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2022-02-20: wsfulton
|
||||||
|
Fix %warnfilter warning suppress for warning 315 SWIGWARN_PARSE_USING_UNDEF.
|
||||||
|
|
||||||
2022-02-17: olly
|
2022-02-17: olly
|
||||||
[PHP] https://sourceforge.net/p/swig/bugs/1211/
|
[PHP] https://sourceforge.net/p/swig/bugs/1211/
|
||||||
Fix to call cleanup code in exception situations and not to invoke
|
Fix to call cleanup code in exception situations and not to invoke
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
%module using2
|
%module using2
|
||||||
|
|
||||||
%warnfilter(SWIGWARN_PARSE_USING_UNDEF);
|
%warnfilter(SWIGWARN_PARSE_USING_UNDEF) ::baz;
|
||||||
|
|
||||||
using ::baz;
|
using ::baz;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1863,7 +1863,7 @@ extend_directive : EXTEND options classkeyopt idcolon LBRACE {
|
||||||
} else {
|
} else {
|
||||||
/* Previous typedef class definition. Use its symbol table.
|
/* Previous typedef class definition. Use its symbol table.
|
||||||
Deprecated, just the real name should be used.
|
Deprecated, just the real name should be used.
|
||||||
Note that %extend before the class typedef never worked, only %extend after the class typdef. */
|
Note that %extend before the class typedef never worked, only %extend after the class typedef. */
|
||||||
prev_symtab = Swig_symbol_setscope(Getattr(cls, "symtab"));
|
prev_symtab = Swig_symbol_setscope(Getattr(cls, "symtab"));
|
||||||
current_class = cls;
|
current_class = cls;
|
||||||
SWIG_WARN_NODE_BEGIN(cls);
|
SWIG_WARN_NODE_BEGIN(cls);
|
||||||
|
|
@ -4481,12 +4481,11 @@ templateparameterstail : COMMA templateparameter templateparameterstail {
|
||||||
/* Namespace support */
|
/* Namespace support */
|
||||||
|
|
||||||
cpp_using_decl : USING idcolon SEMI {
|
cpp_using_decl : USING idcolon SEMI {
|
||||||
String *uname = Swig_symbol_type_qualify($2,0);
|
String *uname = Swig_symbol_type_qualify($2,0);
|
||||||
String *name = Swig_scopename_last($2);
|
String *name = Swig_scopename_last($2);
|
||||||
$$ = new_node("using");
|
$$ = new_node("using");
|
||||||
Setattr($$,"uname",uname);
|
Setattr($$,"uname",uname);
|
||||||
Setattr($$,"name", name);
|
Setattr($$,"name", name);
|
||||||
Swig_symbol_add_using(name, uname, $$);
|
|
||||||
Delete(uname);
|
Delete(uname);
|
||||||
Delete(name);
|
Delete(name);
|
||||||
add_symbols($$);
|
add_symbols($$);
|
||||||
|
|
|
||||||
|
|
@ -1143,7 +1143,7 @@ int JSEmitter::emitConstant(Node *n) {
|
||||||
String *rawval = Getattr(n, "rawval");
|
String *rawval = Getattr(n, "rawval");
|
||||||
String *value = rawval ? rawval : Getattr(n, "value");
|
String *value = rawval ? rawval : Getattr(n, "value");
|
||||||
|
|
||||||
// HACK: forcing usage of cppvalue for v8 (which turned out to fix typdef_struct.i, et. al)
|
// HACK: forcing usage of cppvalue for v8 (which turned out to fix typedef_struct.i, et. al)
|
||||||
if (State::IsSet(state.globals(FORCE_CPP)) && Getattr(n, "cppvalue") != NULL) {
|
if (State::IsSet(state.globals(FORCE_CPP)) && Getattr(n, "cppvalue") != NULL) {
|
||||||
value = Getattr(n, "cppvalue");
|
value = Getattr(n, "cppvalue");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,6 @@ extern "C" {
|
||||||
extern void Swig_symbol_print_tables_summary(void);
|
extern void Swig_symbol_print_tables_summary(void);
|
||||||
extern void Swig_symbol_print_symbols(void);
|
extern void Swig_symbol_print_symbols(void);
|
||||||
extern void Swig_symbol_print_csymbols(void);
|
extern void Swig_symbol_print_csymbols(void);
|
||||||
extern void Swig_symbol_add_using(String *name, String *uname, Node *n);
|
|
||||||
extern void Swig_symbol_init(void);
|
extern void Swig_symbol_init(void);
|
||||||
extern void Swig_symbol_setscopename(const_String_or_char_ptr name);
|
extern void Swig_symbol_setscopename(const_String_or_char_ptr name);
|
||||||
extern String *Swig_symbol_getscopename(void);
|
extern String *Swig_symbol_getscopename(void);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "swig.h"
|
#include "swig.h"
|
||||||
#include "swigwarn.h"
|
#include "cparse.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
/* #define SWIG_DEBUG*/
|
/* #define SWIG_DEBUG*/
|
||||||
|
|
@ -382,29 +382,6 @@ String *Swig_symbol_qualified_language_scopename(Symtab *n) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Swig_symbol_add_using()
|
|
||||||
*
|
|
||||||
* Adds a node to the C symbol table for a using declaration.
|
|
||||||
* Used for using-declarations within classes/structs.
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void Swig_symbol_add_using(String *name, String *uname, Node *n) {
|
|
||||||
Hash *h;
|
|
||||||
h = Swig_symbol_clookup(uname, 0);
|
|
||||||
if (h && (checkAttribute(h, "kind", "class") || checkAttribute(h, "kind", "struct"))) {
|
|
||||||
String *qcurrent = Swig_symbol_qualifiedscopename(0);
|
|
||||||
if (qcurrent) {
|
|
||||||
Append(qcurrent, "::");
|
|
||||||
Append(qcurrent, name);
|
|
||||||
} else {
|
|
||||||
qcurrent = NewString(name);
|
|
||||||
}
|
|
||||||
Setattr(symtabs, qcurrent, n);
|
|
||||||
Delete(qcurrent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Swig_symbol_newscope()
|
* Swig_symbol_newscope()
|
||||||
*
|
*
|
||||||
|
|
@ -664,10 +641,11 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
|
||||||
|
|
||||||
{
|
{
|
||||||
Node *td = n;
|
Node *td = n;
|
||||||
while (td && Checkattr(td, "nodeType", "cdecl") && Checkattr(td, "storage", "typedef")) {
|
while (td && ((Equal(nodeType(td), "cdecl") && Checkattr(td, "storage", "typedef")) || (Equal(nodeType(td), "using") && !Getattr(n, "namespace")))) {
|
||||||
SwigType *type;
|
SwigType *type;
|
||||||
Node *td1;
|
Node *td1;
|
||||||
type = Copy(Getattr(td, "type"));
|
int using_not_typedef = Equal(nodeType(td), "using");
|
||||||
|
type = Copy(Getattr(td, using_not_typedef ? "uname" : "type"));
|
||||||
SwigType_push(type, Getattr(td, "decl"));
|
SwigType_push(type, Getattr(td, "decl"));
|
||||||
td1 = Swig_symbol_clookup(type, 0);
|
td1 = Swig_symbol_clookup(type, 0);
|
||||||
|
|
||||||
|
|
@ -688,9 +666,13 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
|
||||||
ie, when Foo -> FooBar -> Foo, jump one scope up when possible.
|
ie, when Foo -> FooBar -> Foo, jump one scope up when possible.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
if (td1 && Checkattr(td1, "storage", "typedef")) {
|
if (td1) {
|
||||||
String *st = Getattr(td1, "type");
|
String *st = 0;
|
||||||
String *sn = Getattr(td, "name");
|
String *sn = Getattr(td, "name");
|
||||||
|
if (Equal(nodeType(td1), "cdecl") && Checkattr(td1, "storage", "typedef"))
|
||||||
|
st = Getattr(td1, "type");
|
||||||
|
else if (Equal(nodeType(td1), "using") && !Getattr(td1, "namespace"))
|
||||||
|
st = Getattr(td1, "uname");
|
||||||
if (st && sn && Equal(st, sn)) {
|
if (st && sn && Equal(st, sn)) {
|
||||||
Symtab *sc = Getattr(current_symtab, "parentNode");
|
Symtab *sc = Getattr(current_symtab, "parentNode");
|
||||||
if (sc)
|
if (sc)
|
||||||
|
|
@ -1097,19 +1079,7 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
|
||||||
Delete(qalloc);
|
Delete(qalloc);
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
if (checkAttribute(st, "nodeType", "using")) {
|
n = symbol_lookup(name, st, checkfunc);
|
||||||
String *uname = Getattr(st, "uname");
|
|
||||||
if (uname) {
|
|
||||||
st = Getattr(symtabs, uname);
|
|
||||||
if (st) {
|
|
||||||
n = symbol_lookup(name, st, checkfunc);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Error: Found corrupt 'using' node\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Getattr(st, "csymtab")) {
|
|
||||||
n = symbol_lookup(name, st, checkfunc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (qalloc)
|
if (qalloc)
|
||||||
Delete(qalloc);
|
Delete(qalloc);
|
||||||
|
|
@ -1212,7 +1182,9 @@ Node *Swig_symbol_clookup(const_String_or_char_ptr name, Symtab *n) {
|
||||||
Symtab *un = Getattr(s, "sym:symtab");
|
Symtab *un = Getattr(s, "sym:symtab");
|
||||||
Node *ss = (!Equal(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */
|
Node *ss = (!Equal(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */
|
||||||
if (!ss) {
|
if (!ss) {
|
||||||
|
SWIG_WARN_NODE_BEGIN(s);
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
||||||
|
SWIG_WARN_NODE_END(s);
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
@ -1284,7 +1256,9 @@ Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*
|
||||||
Node *ss;
|
Node *ss;
|
||||||
ss = Swig_symbol_clookup(Getattr(s, "uname"), Getattr(s, "sym:symtab"));
|
ss = Swig_symbol_clookup(Getattr(s, "uname"), Getattr(s, "sym:symtab"));
|
||||||
if (!ss && !checkfunc) {
|
if (!ss && !checkfunc) {
|
||||||
|
SWIG_WARN_NODE_BEGIN(s);
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
||||||
|
SWIG_WARN_NODE_END(s);
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
@ -1335,7 +1309,9 @@ Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
|
||||||
while (s && Checkattr(s, "nodeType", "using")) {
|
while (s && Checkattr(s, "nodeType", "using")) {
|
||||||
Node *ss = Swig_symbol_clookup_local(Getattr(s, "uname"), Getattr(s, "sym:symtab"));
|
Node *ss = Swig_symbol_clookup_local(Getattr(s, "uname"), Getattr(s, "sym:symtab"));
|
||||||
if (!ss) {
|
if (!ss) {
|
||||||
|
SWIG_WARN_NODE_BEGIN(s);
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
||||||
|
SWIG_WARN_NODE_END(s);
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
@ -1383,7 +1359,9 @@ Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n,
|
||||||
while (s && Checkattr(s, "nodeType", "using")) {
|
while (s && Checkattr(s, "nodeType", "using")) {
|
||||||
Node *ss = Swig_symbol_clookup_local_check(Getattr(s, "uname"), Getattr(s, "sym:symtab"), checkfunc);
|
Node *ss = Swig_symbol_clookup_local_check(Getattr(s, "uname"), Getattr(s, "sym:symtab"), checkfunc);
|
||||||
if (!ss && !checkfunc) {
|
if (!ss && !checkfunc) {
|
||||||
|
SWIG_WARN_NODE_BEGIN(s);
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", SwigType_namestr(Getattr(s, "uname")));
|
||||||
|
SWIG_WARN_NODE_END(s);
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue