Remove unnecessary Identifier redefined warning when a using statement redefines a symbol. Behaviour is now like a duplicate typedef of the same symbol.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12826 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
da82c2fef7
commit
fbd6d780b7
3 changed files with 30 additions and 4 deletions
|
|
@ -287,6 +287,7 @@ CPP_TEST_CASES += \
|
||||||
protected_rename \
|
protected_rename \
|
||||||
pure_virtual \
|
pure_virtual \
|
||||||
redefined \
|
redefined \
|
||||||
|
redefined_not \
|
||||||
refcount \
|
refcount \
|
||||||
reference_global_vars \
|
reference_global_vars \
|
||||||
register_par \
|
register_par \
|
||||||
|
|
|
||||||
13
Examples/test-suite/redefined_not.i
Normal file
13
Examples/test-suite/redefined_not.i
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
%module redefined_not
|
||||||
|
|
||||||
|
// These should not emit an Identifer redefined warning
|
||||||
|
%inline %{
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
namespace std {
|
||||||
|
using ::size_t;
|
||||||
|
}
|
||||||
|
using std::size_t;
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
using std::size_t;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
@ -893,11 +893,14 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) {
|
||||||
/* they must have the same type */
|
/* they must have the same type */
|
||||||
String *ta = nodeType(a);
|
String *ta = nodeType(a);
|
||||||
String *tb = nodeType(b);
|
String *tb = nodeType(b);
|
||||||
if (Cmp(ta, tb) != 0)
|
if (!Equal(ta, tb)) {
|
||||||
return 0;
|
if (!(Equal(ta, "using") && Equal(tb, "cdecl"))) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* cdecl case */
|
|
||||||
if (Cmp(ta, "cdecl") == 0) {
|
if (Cmp(ta, "cdecl") == 0) {
|
||||||
|
/* both cdecl case */
|
||||||
/* typedef */
|
/* typedef */
|
||||||
String *a_storage = Getattr(a, "storage");
|
String *a_storage = Getattr(a, "storage");
|
||||||
String *b_storage = Getattr(b, "storage");
|
String *b_storage = Getattr(b, "storage");
|
||||||
|
|
@ -956,8 +959,17 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (Equal(ta, "using")) {
|
||||||
|
/* using and cdecl case */
|
||||||
|
String *b_storage = Getattr(b, "storage");
|
||||||
|
if (Equal(b_storage, "typedef")) {
|
||||||
|
String *a_name = Getattr(a, "name");
|
||||||
|
String *b_name = Getattr(b, "name");
|
||||||
|
if (Equal(a_name, b_name))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* %constant case */
|
/* both %constant case */
|
||||||
String *a_storage = Getattr(a, "storage");
|
String *a_storage = Getattr(a, "storage");
|
||||||
String *b_storage = Getattr(b, "storage");
|
String *b_storage = Getattr(b, "storage");
|
||||||
if ((Cmp(a_storage, "%constant") == 0)
|
if ((Cmp(a_storage, "%constant") == 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue