Add support for thread_local when specified with other legitimate storage class specifiers - extern and static
This commit is contained in:
parent
c6bc7b881f
commit
b725625e6f
15 changed files with 145 additions and 24 deletions
|
|
@ -922,7 +922,7 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
|
|||
self = NewString("(*(this))->");
|
||||
is_smart_pointer_overload = 1;
|
||||
}
|
||||
else if (Cmp(Getattr(n, "storage"), "static") == 0) {
|
||||
else if (Swig_storage_isstatic(n)) {
|
||||
String *cname = Getattr(n, "classname") ? Getattr(n, "classname") : classname;
|
||||
String *ctname = SwigType_namestr(cname);
|
||||
self = NewStringf("(*(%s const *)this)->", ctname);
|
||||
|
|
@ -1064,7 +1064,7 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
|
|||
String *func = NewStringf("%s(", mangled);
|
||||
String *cres;
|
||||
|
||||
if (Cmp(Getattr(n, "storage"), "static") != 0) {
|
||||
if (!Swig_storage_isstatic(n)) {
|
||||
String *pname = Swig_cparm_name(pp, i);
|
||||
String *ctname = SwigType_namestr(cname);
|
||||
String *fadd = 0;
|
||||
|
|
@ -1467,7 +1467,7 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
|
|||
int varcref = flags & CWRAP_NATURAL_VAR;
|
||||
|
||||
if (flags & CWRAP_SMART_POINTER) {
|
||||
if (checkAttribute(n, "storage", "static")) {
|
||||
if (Swig_storage_isstatic(n)) {
|
||||
Node *sn = Getattr(n, "cplus:staticbase");
|
||||
String *base = Getattr(sn, "name");
|
||||
self = NewStringf("%s::", base);
|
||||
|
|
|
|||
|
|
@ -262,6 +262,27 @@ void Swig_filename_unescape(String *filename) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_storage_isstatic_custom()
|
||||
*
|
||||
* Determine if the storage class specifier is static
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int Swig_storage_isstatic_custom(Node *n, const_String_or_char_ptr storage_name) {
|
||||
const String *storage = Getattr(n, storage_name);
|
||||
return storage ? Strncmp(storage, "static", 6) == 0 : 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_storage_isstatic()
|
||||
*
|
||||
* Determine if the storage class specifier is static
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int Swig_storage_isstatic(Node *n) {
|
||||
return Swig_storage_isstatic_custom(n, "storage");
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_string_escape()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -938,8 +938,7 @@ static int nodes_are_equivalent(Node *a, Node *b, int a_inclass) {
|
|||
}
|
||||
|
||||
/* static functions */
|
||||
if ((Cmp(a_storage, "static") == 0)
|
||||
|| (Cmp(b_storage, "static") == 0)) {
|
||||
if (Swig_storage_isstatic(a) || Swig_storage_isstatic(b)) {
|
||||
if (Cmp(a_storage, b_storage) != 0)
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,6 +315,8 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern void Swig_filename_correct(String *filename);
|
||||
extern String *Swig_filename_escape(String *filename);
|
||||
extern void Swig_filename_unescape(String *filename);
|
||||
extern int Swig_storage_isstatic_custom(Node *n, const_String_or_char_ptr storage);
|
||||
extern int Swig_storage_isstatic(Node *n);
|
||||
extern String *Swig_string_escape(String *s);
|
||||
extern String *Swig_string_mangle(const String *s);
|
||||
extern void Swig_scopename_split(const String *s, String **prefix, String **last);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue