Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C: add _Thread_local C11 keyword #3603

Merged
merged 1 commit into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Units/parser-c.r/properties-thread.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
i input.c /^__thread int i;$/;" v typeref:typename:int properties:thread_local
s input.c /^extern __thread struct state s;$/;" x typeref:struct:state properties:extern,thread_local
p input.c /^static __thread char *p;$/;" v typeref:typename:char * file: properties:static,thread_local
q input.c /^static _Thread_local char *q;$/;" v typeref:typename:char * file: properties:static,thread_local
2 changes: 2 additions & 0 deletions Units/parser-c.r/properties-thread.d/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
__thread int i;
extern __thread struct state s;
static __thread char *p;

static _Thread_local char *q;
5 changes: 5 additions & 0 deletions parsers/cxx/cxx_keyword.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ static CXXKeywordDescriptor g_aCXXKeywordTable[] = {
CXXLanguageC | CXXLanguageCPP,
CXXKeywordMayAppearInVariableDeclaration | CXXKeywordExcludeFromTypeNames,
},
{
"_Thread_local",
CXXLanguageC,
CXXKeywordMayAppearInVariableDeclaration | CXXKeywordExcludeFromTypeNames,
},
{
"alignas",
CXXLanguageCPP,
Expand Down
1 change: 1 addition & 0 deletions parsers/cxx/cxx_keyword.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ typedef enum _CXXKeyword
CXXKeyword__STDCALL, // Microsoft C/C++
CXXKeyword__THISCALL, // Microsoft C/C++
CXXKeyword__THREAD, // GCC (https://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Thread-Local.html#Thread-Local)
CXXKeyword_THREAD_LOCAL, // C11
CXXKeywordALIGNAS, // (since C++11)
CXXKeywordALIGNOF, // (since C++11)
//CXXKeywordAND,
Expand Down
1 change: 1 addition & 0 deletions parsers/cxx/cxx_parser_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ static bool cxxParserParseBlockInternal(bool bExpectClosingBracket)
break;
case CXXKeywordTHREAD_LOCAL:
case CXXKeyword__THREAD:
case CXXKeyword_THREAD_LOCAL:
g_cxx.uKeywordState |= CXXParserKeywordStateSeenThreadLocal;
break;

Expand Down