aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Tools/c-analyzer/c_parser/preprocessor/gcc.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-03 10:23:43 +0200
committerGitHub <noreply@github.com>2023-07-03 10:23:43 +0200
commit5ccbbe5bb9a659fa8f2fe551428c84cc14015f44 (patch)
treedda828881a98a880d128b97c1072fc08b7b262b1 /Tools/c-analyzer/c_parser/preprocessor/gcc.py
parentd65b783b6966d233467a48ef633afb4aff9d5df8 (diff)
downloadcpython-5ccbbe5bb9a659fa8f2fe551428c84cc14015f44.tar.gz
cpython-5ccbbe5bb9a659fa8f2fe551428c84cc14015f44.zip
gh-106320: Move _PyUnicodeWriter to the internal C API (#106342)
Move also _PyUnicode_FormatAdvancedWriter(). CJK codecs and multibytecodec.c now define the Py_BUILD_CORE_MODULE macro.
Diffstat (limited to 'Tools/c-analyzer/c_parser/preprocessor/gcc.py')
-rw-r--r--Tools/c-analyzer/c_parser/preprocessor/gcc.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
index 0929f7111ea..415a2ba63df 100644
--- a/Tools/c-analyzer/c_parser/preprocessor/gcc.py
+++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
@@ -3,6 +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 = {
+ 'cjkcodecs.h',
+ 'multibytecodec.h',
+ 'socketmodule.h',
+}
TOOL = 'gcc'
@@ -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(