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
|
|
@ -1863,7 +1863,7 @@ extend_directive : EXTEND options classkeyopt idcolon LBRACE {
|
|||
} else {
|
||||
/* Previous typedef class definition. Use its symbol table.
|
||||
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"));
|
||||
current_class = cls;
|
||||
SWIG_WARN_NODE_BEGIN(cls);
|
||||
|
|
@ -4481,12 +4481,11 @@ templateparameterstail : COMMA templateparameter templateparameterstail {
|
|||
/* Namespace support */
|
||||
|
||||
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);
|
||||
$$ = new_node("using");
|
||||
$$ = new_node("using");
|
||||
Setattr($$,"uname",uname);
|
||||
Setattr($$,"name", name);
|
||||
Swig_symbol_add_using(name, uname, $$);
|
||||
Delete(uname);
|
||||
Delete(name);
|
||||
add_symbols($$);
|
||||
|
|
|
|||
|
|
@ -1143,7 +1143,7 @@ int JSEmitter::emitConstant(Node *n) {
|
|||
String *rawval = Getattr(n, "rawval");
|
||||
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) {
|
||||
value = Getattr(n, "cppvalue");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,6 @@ extern "C" {
|
|||
extern void Swig_symbol_print_tables_summary(void);
|
||||
extern void Swig_symbol_print_symbols(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_setscopename(const_String_or_char_ptr name);
|
||||
extern String *Swig_symbol_getscopename(void);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include "swig.h"
|
||||
#include "swigwarn.h"
|
||||
#include "cparse.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/* #define SWIG_DEBUG*/
|
||||
|
|
@ -382,29 +382,6 @@ String *Swig_symbol_qualified_language_scopename(Symtab *n) {
|
|||
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()
|
||||
*
|
||||
|
|
@ -664,10 +641,11 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *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;
|
||||
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"));
|
||||
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.
|
||||
|
||||
*/
|
||||
if (td1 && Checkattr(td1, "storage", "typedef")) {
|
||||
String *st = Getattr(td1, "type");
|
||||
if (td1) {
|
||||
String *st = 0;
|
||||
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)) {
|
||||
Symtab *sc = Getattr(current_symtab, "parentNode");
|
||||
if (sc)
|
||||
|
|
@ -1097,19 +1079,7 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
|
|||
Delete(qalloc);
|
||||
return st;
|
||||
}
|
||||
if (checkAttribute(st, "nodeType", "using")) {
|
||||
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);
|
||||
}
|
||||
n = symbol_lookup(name, st, checkfunc);
|
||||
}
|
||||
if (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");
|
||||
Node *ss = (!Equal(name, uname) || (un != n)) ? Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */
|
||||
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_WARN_NODE_END(s);
|
||||
}
|
||||
s = ss;
|
||||
}
|
||||
|
|
@ -1284,7 +1256,9 @@ Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*
|
|||
Node *ss;
|
||||
ss = Swig_symbol_clookup(Getattr(s, "uname"), Getattr(s, "sym:symtab"));
|
||||
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_WARN_NODE_END(s);
|
||||
}
|
||||
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")) {
|
||||
Node *ss = Swig_symbol_clookup_local(Getattr(s, "uname"), Getattr(s, "sym:symtab"));
|
||||
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_WARN_NODE_END(s);
|
||||
}
|
||||
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")) {
|
||||
Node *ss = Swig_symbol_clookup_local_check(Getattr(s, "uname"), Getattr(s, "sym:symtab"), 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_WARN_NODE_END(s);
|
||||
}
|
||||
s = ss;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue