8000 gh-135927: Fix MSVC Clatest C builds (GH-135935) · python/cpython@a88b49c · GitHub
[go: up one dir, main page]

Skip to content

Commit a88b49c

Browse files
gh-135927: Fix MSVC Clatest C builds (GH-135935)
1 parent d215491 commit a88b49c

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

Include/pymacro.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
# else
7474
# define _Py_ALIGNED_DEF(N, T) alignas(N) alignas(T) T
7575
# endif
76+
# elif defined(_MSC_VER)
77+
# define _Py_ALIGNED_DEF(N, T) __declspec(align(N)) T
7678
# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
7779
# define _Py_ALIGNED_DEF(N, T) alignas(N) alignas(T) T
7880
# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
7981
# define _Py_ALIGNED_DEF(N, T) _Alignas(N) _Alignas(T) T
8082
# elif (defined(__GNUC__) || defined(__clang__))
8183
# define _Py_ALIGNED_DEF(N, T) __attribute__((aligned(N))) T
82-
# elif defined(_MSC_VER)
83-
# define _Py_ALIGNED_DEF(N, T) __declspec(align(N)) T
8484
# else
8585
# define _Py_ALIGNED_DEF(N, T) _Alignas(N) _Alignas(T) T
8686
# endif

Include/pyport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
// Static inline functions should use _Py_NULL rather than using directly NULL
5050
// to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer,
5151
// _Py_NULL is defined as nullptr.
52-
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \
52+
#if (defined(__GNUC__) || defined(__clang__)) && \
53+
(defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \
5354
|| (defined(__cplusplus) && __cplusplus >= 201103)
5455
# define _Py_NULL nullptr
5556
#else
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix building with MSVC when passing option ``/std:clatest``.

Modules/mathmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,7 @@ static PyObject *
31483148
math_issubnormal_impl(PyObject *module, double x)
31493149
/*[clinic end generated code: output=4e76ac98ddcae761 input=9a20aba7107d0d95]*/
31503150
{
3151-
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
3151+
#if !defined(_MSC_VER) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
31523152
return PyBool_FromLong(issubnormal(x));
31533153
#else
31543154
return PyBool_FromLong(isfinite(x) && x && !isnormal(x));

0 commit comments

Comments
 (0)
0