diff options
Diffstat (limited to 'Tools/c-analyzer/c_parser/preprocessor')
-rw-r--r-- | Tools/c-analyzer/c_parser/preprocessor/gcc.py | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py index de9a2484de8..55cc2d37e1e 100644 --- a/Tools/c-analyzer/c_parser/preprocessor/gcc.py +++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py @@ -3,26 +3,14 @@ import re 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 = { - # Header ".h" files - 'cjkcodecs.h', - 'multibytecodec.h', - 'socketmodule.h', - - # Argument Clinic ".c.h" header files - '_testclinic.c.h', - '_testclinic_depr.c.h', - '_winapi.c.h', - 'fcntlmodule.c.h', - 'overlapped.c.h', - 'posixmodule.c.h', - 'selectmodule.c.h', - 'sha3module.c.h', - 'termios.c.h', -} +# The following C files must not be built with Py_BUILD_CORE, +# because they use the limited C API. +USE_LIMITED_C_API = frozenset(( + '_testcapimodule.c', + '_testclinic_limited.c', + 'xxlimited.c', + 'xxlimited_35.c', +)) TOOL = 'gcc' @@ -81,8 +69,9 @@ def preprocess(filename, cwd = os.path.abspath(cwd or '.') filename = _normpath(filename, cwd) + print(filename) postargs = POST_ARGS - if os.path.basename(filename) in NEED_BUILD_CORE: + if os.path.basename(filename) not in USE_LIMITED_C_API: postargs += ('-DPy_BUILD_CORE=1',) text = _common.preprocess( |