8000 Ignore the thread-local variables in the c-analyzer. · python/cpython@fb33d71 · GitHub
[go: up one dir, main page]

Skip to content

Commit fb33d71

Browse files
Ignore the thread-local variables in the c-analyzer.
1 parent 83bbb3a commit fb33d71

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Tools/c-analyzer/c_parser/parser/_regexes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def _ind(text, level=1, edges='both'):
5858
extern |
5959
register |
6060
static |
61+
_Thread_local |
6162
typedef |
6263
6364
const |
@@ -137,7 +138,7 @@ def _ind(text, level=1, edges='both'):
137138
#######################################
138139
# variable declarations
139140

140-
_STORAGE = 'auto register static extern'.split()
141+
_STORAGE = 'auto register static extern _Thread_local'.split()
141142
STORAGE_CLASS = rf'(?: \b (?: {" | ".join(_STORAGE)} ) \b )'
142143
TYPE_QUALIFIER = r'(?: \b (?: const | volatile ) \b )'
143144
PTR_QUALIFIER = rf'(?: [*] (?: \s* {TYPE_QUALIFIER} )? )'

Tools/c-analyzer/c_parser/preprocessor/gcc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def _strip_directives(line, partial=0):
219219
line = line[m.end():]
220220

221221
line = re.sub(r'__extension__', '', line)
222+
line = re.sub(r'__thread\b', '_Thread_local', line)
222223

223224
while (m := COMPILER_DIRECTIVE_RE.match(line)):
224225
before, _, _, closed = m.groups()

Tools/c-analyzer/cpython/ignored.tsv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ Modules/_xxinterpchannelsmodule.c - _globals -
168168

169169
Python/pyfpe.c - PyFPE_counter -
170170

171+
##-----------------------
172+
## thread-local variables
173+
174+
Python/import.c - pkgcontext -
175+
Python/pystate.c - _Py_tss_tstate -
176+
171177
##-----------------------
172178
## should be const
173179
# XXX Make them const.

0 commit comments

Comments
 (0)
0