Merge master and C++11 strongly typed enum support

Merging from master:
* 'master' of github.com:/swig/swig:
  Add more docs about _global_ prefix in typemap temporary variables
  Add clarification on _global_ prefix.
  fix for nested template defined out of class (issue #265)
  using an unknown constant emits a notice, not a warning
  Fix typo
  Consistently put whitespace outside of <tt>...</tt> and not inside
  wording tweak
  Go: Document memory management of C++ classes allocated in Go.  Fixes #266.
  revert unrelated file
  Fix #224
  Fixes for clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error
  delete unmeaningful macro
  Go: fix overload functions with polymorphic issue
  del tmp files
  GoLang:fix overload functions with polymorphic issue
This commit is contained in:
William S Fulton 2014-12-07 17:33:16 +00:00
commit b9b9b3cd21
18 changed files with 157 additions and 42 deletions

View file

@ -2504,6 +2504,7 @@ types_directive : TYPES LPAREN parms RPAREN stringbracesemi {
template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN valparms GREATERTHAN SEMI {
Parm *p, *tp;
Node *n;
Node *outer_class = currentOuterClass;
Symtab *tscope = 0;
int specialized = 0;
int variadic = 0;
@ -2516,6 +2517,9 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
if (!inclass) {
$5 = resolve_create_node_scope($5);
}
if (nscope_inner && Strcmp(nodeType(nscope_inner), "class") == 0) {
outer_class = nscope_inner;
}
/*
We use the new namespace entry 'nscope' only to
@ -2648,7 +2652,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
Setattr(templnode,"sym:typename","1");
}
/* for now, nested %template is allowed only in the same scope as the template declaration */
if ($3 && !(nnisclass && ((currentOuterClass && (currentOuterClass != Getattr(nn, "nested:outer")))
if ($3 && !(nnisclass && ((outer_class && (outer_class != Getattr(nn, "nested:outer")))
||(extendmode && current_class && (current_class != Getattr(nn, "nested:outer")))))) {
/*
Comment this out for 1.3.28. We need to
@ -2677,9 +2681,9 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
Setfile(templnode,cparse_file);
Setline(templnode,cparse_line);
Delete(temparms);
if (currentOuterClass) {
if (outer_class && nnisclass) {
SetFlag(templnode, "nested");
Setattr(templnode, "nested:outer", currentOuterClass);
Setattr(templnode, "nested:outer", outer_class);
}
add_symbols_copy(templnode);
@ -4017,7 +4021,9 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN {
Swig_symbol_setscope(cscope);
Delete(Namespaceprefix);
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
if (error) $$ = 0;
if (error || (nscope_inner && Strcmp(nodeType(nscope_inner), "class") == 0)) {
$$ = 0;
}
if (currentOuterClass)
template_parameters = Getattr(currentOuterClass, "template_parameters");
else

View file

@ -181,10 +181,10 @@ static int String_hash(DOH *so) {
return s->hashkey;
} else {
register char *c = s->str;
register int len = s->len > 50 ? 50 : s->len;
register int h = 0;
register int mlen = len >> 2;
register int i = mlen;
register unsigned int len = s->len > 50 ? 50 : s->len;
register unsigned int h = 0;
register unsigned int mlen = len >> 2;
register unsigned int i = mlen;
for (; i; --i) {
h = (h << 5) + *(c++);
h = (h << 5) + *(c++);
@ -195,7 +195,7 @@ static int String_hash(DOH *so) {
h = (h << 5) + *(c++);
}
h &= 0x7fffffff;
s->hashkey = h;
s->hashkey = (int)h;
return h;
}
}

View file

@ -4427,7 +4427,7 @@ private:
}
fn = i + 1;
Printf(f_go_wrappers, "\t\tif _, ok := a[%d].(%s); !ok {\n", j, tm);
Printf(f_go_wrappers, "\t\tif _, ok := a[%d].(%s); !ok {\n", j, goType(pj, Getattr(pj, "type")));
Printf(f_go_wrappers, "\t\t\tgoto check_%d\n", fn);
Printv(f_go_wrappers, "\t\t}\n", NULL);
}