Skip to content

Commit 701aa8d

Browse files
Fix double redeclaration on MSVC+clang-cl
1 parent 68e72cf commit 701aa8d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Include/internal/pycore_debug_offsets.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@ extern "C" {
1717

1818
// Macros to burn global values in custom sections so out-of-process
1919
// profilers can locate them easily.
20-
#define GENERATE_DEBUG_SECTION(name, declaration) \
21-
_GENERATE_DEBUG_SECTION_WINDOWS(name) \
22-
_GENERATE_DEBUG_SECTION_APPLE(name) \
23-
declaration \
24-
_GENERATE_DEBUG_SECTION_LINUX(name)
2520

26-
#if defined(MS_WINDOWS) && !defined(__clang__)
21+
// MSVC+Clang has a bug where it declares it twice.
22+
#if defined(MS_WINDOWS) && defined(__clang__)
23+
# define GENERATE_DEBUG_SECTION(name, declaration) \
24+
_GENERATE_DEBUG_SECTION_WINDOWS(name)
25+
#else
26+
// Everything else
27+
# define GENERATE_DEBUG_SECTION(name, declaration) \
28+
_GENERATE_DEBUG_SECTION_WINDOWS(name) \
29+
_GENERATE_DEBUG_SECTION_APPLE(name) \
30+
declaration \
31+
_GENERATE_DEBUG_SECTION_LINUX(name)
32+
#endif
33+
34+
#if defined(MS_WINDOWS)
2735
#define _GENERATE_DEBUG_SECTION_WINDOWS(name) \
2836
_Pragma(Py_STRINGIFY(section(Py_STRINGIFY(name), read, write))) \
2937
__declspec(allocate(Py_STRINGIFY(name)))

0 commit comments

Comments
 (0)