Skip to content

Commit

Permalink
C: add _Thread_local C11 keyword
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Dec 19, 2022
1 parent bec7905 commit 43c14a7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
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

0 comments on commit 43c14a7

Please sign in to comment.