aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Tools/c-analyzer/c_parser/preprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/c-analyzer/c_parser/preprocessor')
-rw-r--r--Tools/c-analyzer/c_parser/preprocessor/gcc.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
index d206ceb43a2..6ece70c77fd 100644
--- a/Tools/c-analyzer/c_parser/preprocessor/gcc.py
+++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
@@ -3,18 +3,20 @@ import re
from . import common as _common
-# The following C files define the Py_LIMITED_API macro, and so must not be
-# built with the Py_BUILD_CORE macro defined.
-USE_LIMITED_C_API = frozenset((
+# The following C files must not built with Py_BUILD_CORE.
+FILES_WITHOUT_INTERNAL_CAPI = frozenset((
# Modules/
'_testcapimodule.c',
'_testclinic_limited.c',
'xxlimited.c',
'xxlimited_35.c',
+))
+# C files in the fhe following directories must not be built with
+# Py_BUILD_CORE.
+DIRS_WITHOUT_INTERNAL_CAPI = frozenset((
# Modules/_testcapi/
- 'heaptype_relative.c',
- 'vectorcall_limited.c',
+ '_testcapi',
))
TOOL = 'gcc'
@@ -75,7 +77,10 @@ def preprocess(filename,
filename = _normpath(filename, cwd)
postargs = POST_ARGS
- if os.path.basename(filename) not in USE_LIMITED_C_API:
+ basename = os.path.basename(filename)
+ dirname = os.path.basename(os.path.dirname(filename))
+ if (basename not in FILES_WITHOUT_INTERNAL_CAPI
+ and dirname not in DIRS_WITHOUT_INTERNAL_CAPI):
postargs += ('-DPy_BUILD_CORE=1',)
text = _common.preprocess(