mirror of https://github.com/swig/swig
warnfilter fixed
scoping for "anonymous forward declaration" fixed
This commit is contained in:
parent
8fc4fd2893
commit
bda9c90e2b
|
@ -1,5 +1,7 @@
|
||||||
%module namespace_union
|
%module namespace_union
|
||||||
|
|
||||||
|
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
namespace SpatialIndex
|
namespace SpatialIndex
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleNamedTypedef;
|
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleNamedTypedef;
|
||||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerSameName;
|
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerSameName;
|
||||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer2::IgnoreMe;
|
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer2::IgnoreMe;
|
||||||
|
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerSameName2;
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
struct Outer {
|
struct Outer {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
%module nested_comment
|
%module nested_comment
|
||||||
|
|
||||||
|
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||||
|
|
||||||
// this example shows a problem with 'dump_nested' (parser.y).
|
// this example shows a problem with 'dump_nested' (parser.y).
|
||||||
|
|
||||||
// bug #949654
|
// bug #949654
|
||||||
|
|
|
@ -1076,7 +1076,7 @@ static void update_nested_classes(Node *n)
|
||||||
* Create the nested class/struct/union as a forward declaration.
|
* Create the nested class/struct/union as a forward declaration.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static Node *nested_forward_declaration(const char *storage, const char *kind, String *sname, String *name, Node *cpp_opt_declarators) {
|
static Node *nested_forward_declaration(const char *storage, const char *kind, String *sname, String *name, Node *cpp_opt_declarators, Node* nested) {
|
||||||
Node *nn = 0;
|
Node *nn = 0;
|
||||||
int warned = 0;
|
int warned = 0;
|
||||||
|
|
||||||
|
@ -1120,15 +1120,19 @@ static Node *nested_forward_declaration(const char *storage, const char *kind, S
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nn && Equal(nodeType(nn), "classforward")) {
|
if (nn && Equal(nodeType(nn), "classforward")) {
|
||||||
Node *n = nn;
|
Node *n = nested;
|
||||||
SWIG_WARN_NODE_BEGIN(n);
|
SWIG_WARN_NODE_BEGIN(n);
|
||||||
Swig_warning(WARN_PARSE_NAMED_NESTED_CLASS, cparse_file, cparse_line,"Nested %s not currently supported (%s ignored)\n", kind, sname ? sname : name);
|
Swig_warning(WARN_PARSE_NAMED_NESTED_CLASS, cparse_file, cparse_line,"Nested %s not currently supported (%s ignored)\n", kind, sname ? sname : name);
|
||||||
SWIG_WARN_NODE_END(n);
|
SWIG_WARN_NODE_END(n);
|
||||||
warned = 1;
|
warned = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!warned)
|
if (!warned) {
|
||||||
|
Node *n = nested;
|
||||||
|
SWIG_WARN_NODE_BEGIN(n);
|
||||||
Swig_warning(WARN_PARSE_UNNAMED_NESTED_CLASS, cparse_file, cparse_line, "Nested %s not currently supported (ignored).\n", kind);
|
Swig_warning(WARN_PARSE_UNNAMED_NESTED_CLASS, cparse_file, cparse_line, "Nested %s not currently supported (ignored).\n", kind);
|
||||||
|
SWIG_WARN_NODE_END(n);
|
||||||
|
}
|
||||||
|
|
||||||
return nn;
|
return nn;
|
||||||
}
|
}
|
||||||
|
@ -3624,7 +3628,7 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
if (cplus_mode == CPLUS_PRIVATE) {
|
if (cplus_mode == CPLUS_PRIVATE) {
|
||||||
$$ = 0; /* skip private nested classes */
|
$$ = 0; /* skip private nested classes */
|
||||||
} else if (cparse_cplusplus && currentOuterClass && ignore_nested_classes && !GetFlag($$, "feature:flatnested")) {
|
} else if (cparse_cplusplus && currentOuterClass && ignore_nested_classes && !GetFlag($$, "feature:flatnested")) {
|
||||||
$$ = nested_forward_declaration($1, $2, $3, Copy($3), $9);
|
$$ = nested_forward_declaration($1, $2, $3, Copy($3), $9, $$);
|
||||||
} else if (nscope_inner) {
|
} else if (nscope_inner) {
|
||||||
/* this is tricky */
|
/* this is tricky */
|
||||||
/* we add the declaration in the original namespace */
|
/* we add the declaration in the original namespace */
|
||||||
|
@ -3737,7 +3741,10 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
Swig_features_get(Swig_cparse_features(), Namespaceprefix, 0, 0, $$);
|
Swig_features_get(Swig_cparse_features(), Namespaceprefix, 0, 0, $$);
|
||||||
if (cparse_cplusplus && currentOuterClass && ignore_nested_classes && !GetFlag($$, "feature:flatnested")) {
|
if (cparse_cplusplus && currentOuterClass && ignore_nested_classes && !GetFlag($$, "feature:flatnested")) {
|
||||||
String *name = n ? Copy(Getattr(n, "name")) : 0;
|
String *name = n ? Copy(Getattr(n, "name")) : 0;
|
||||||
$$ = nested_forward_declaration($1, $2, 0, name, n);
|
$$ = nested_forward_declaration($1, $2, 0, name, n, $$);
|
||||||
|
Swig_symbol_popscope();
|
||||||
|
Delete(Namespaceprefix);
|
||||||
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
} else if (n) {
|
} else if (n) {
|
||||||
appendSibling($$,n);
|
appendSibling($$,n);
|
||||||
/* If a proper typedef name was given, we'll use it to set the scope name */
|
/* If a proper typedef name was given, we'll use it to set the scope name */
|
||||||
|
|
Loading…
Reference in New Issue