summaryrefslogtreecommitdiffstats
path: root/Tools/c-analyzer
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/c-analyzer')
-rw-r--r--Tools/c-analyzer/c_parser/preprocessor/gcc.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
index 1476157..0929f71 100644
--- a/Tools/c-analyzer/c_parser/preprocessor/gcc.py
+++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
@@ -60,6 +60,13 @@ def preprocess(filename,
if not cwd or not os.path.isabs(cwd):
cwd = os.path.abspath(cwd or '.')
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.
+ postargs += ('-DPy_BUILD_CORE=1',)
+
text = _common.preprocess(
TOOL,
filename,
@@ -67,7 +74,7 @@ def preprocess(filename,
includes=includes,
macros=macros,
#preargs=PRE_ARGS,
- postargs=POST_ARGS,
+ postargs=postargs,
executable=['gcc'],
compiler='unix',
cwd=cwd,