summarylogtreecommitdiffstats
path: root/0054-Add-AMD64-to-sys-config-so-msvccompiler-get_build_ve.patch
blob: 27b75594704d800ccbb5cfcab158034da9911823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 887b0e7895143809d0c8170caa3a4dd2306efefd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
 <alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:52:07 +0530
Subject: [PATCH 054/N] Add AMD64 to sys config so msvccompiler
 get_build_version works

---
 Python/getcompiler.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/Python/getcompiler.c b/Python/getcompiler.c
index 59c0dbf..adccaa7 100644
--- a/Python/getcompiler.c
+++ b/Python/getcompiler.c
@@ -10,7 +10,22 @@
 #if defined(__clang__)
 #define COMPILER "\n[Clang " __clang_version__ "]"
 #elif defined(__GNUC__)
-#define COMPILER "\n[GCC " __VERSION__ "]"
+/* To not break compatibility with things that determine
+   CPU arch by calling get_build_version in msvccompiler.py
+   (such as NumPy) add "32 bit" or "64 bit (AMD64)" on Windows
+   and also use a space as a separator rather than a newline. */
+#if defined(_WIN32)
+#define COMP_SEP " "
+#if defined(__x86_64__)
+#define ARCH_SUFFIX " 64 bit (AMD64)"
+#else
+#define ARCH_SUFFIX " 32 bit"
+#endif
+#else
+#define COMP_SEP "\n"
+#define ARCH_SUFFIX ""
+#endif
+#define COMPILER COMP_SEP "[GCC " __VERSION__ ARCH_SUFFIX "]"
 // Generic fallbacks.
 #elif defined(__cplusplus)
 #define COMPILER "[C++]"
-- 
2.33.0