Preserve thread_local for brace-enclosed extern "C"

This commit is contained in:
Seth R Johnson 2022-02-10 07:33:09 -05:00 committed by Olly Betts
commit 14c0942505

View file

@ -3133,15 +3133,22 @@ c_declaration : c_decl {
Setattr($$,"name",$2);
appendChild($$,n);
while (n) {
if (!Equal(Getattr(n, "storage"), "typedef")) {
String *s = Getattr(n, "storage");
if (s) {
if (Strstr(s, "thread_local")) {
Insert(s,0,"externc ");
} else if (!Equal(s, "typedef")) {
Setattr(n,"storage","externc");
}
} else {
Setattr(n,"storage","externc");
}
n = nextSibling(n);
}
} else {
if (!Equal($2,"C++")) {
if (!Equal($2,"C++")) {
Swig_warning(WARN_PARSE_UNDEFINED_EXTERN,cparse_file, cparse_line,"Unrecognized extern type \"%s\".\n", $2);
}
}
$$ = new_node("extern");
Setattr($$,"name",$2);
appendChild($$,firstChild($5));