Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Fix c-analyzer
  • Loading branch information
vstinner committed Jul 2, 2023
commit 0b9c3040a3729e287a52968075a1be955960b278
12 changes: 9 additions & 3 deletions Tools/c-analyzer/c_parser/preprocessor/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

from . import common as _common

# Modules/socketmodule.h uses pycore_time.h which needs the Py_BUILD_CORE
# macro. Usually it's defined by the C file which includes it.
# Other header files have a similar issue.
NEED_BUILD_CORE = {
'cjkcodecs.h',
'multibytecodec.h',
'socketmodule.h',
}

TOOL = 'gcc'

Expand Down Expand Up @@ -62,9 +70,7 @@ def preprocess(filename,
filename = _normpath(filename, cwd)

postargs = POST_ARGS
if os.path.basename(filename) == 'socketmodule.h':
# Modules/socketmodule.h uses pycore_time.h which needs Py_BUILD_CORE.
# Usually it's defined by the C file which includes it.
if os.path.basename(filename) in NEED_BUILD_CORE:
postargs += ('-DPy_BUILD_CORE=1',)

text = _common.preprocess(
Expand Down