Skip to content

Commit 3015fb8

Browse files
authored
bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)
Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER. Project based C Preprocessor namespacing at its finest. :P
1 parent 0dc1e45 commit 3015fb8

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

Include/Python.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
/* A convenient way for code to know if clang's memory sanitizer is enabled. */
5757
#if defined(__has_feature)
5858
# if __has_feature(memory_sanitizer)
59-
# if !defined(MEMORY_SANITIZER)
60-
# define MEMORY_SANITIZER
59+
# if !defined(_Py_MEMORY_SANITIZER)
60+
# define _Py_MEMORY_SANITIZER
6161
# endif
6262
# endif
6363
#endif

Modules/_ctypes/callproc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
#include <alloca.h>
7676
#endif
7777

78-
#ifdef MEMORY_SANITIZER
78+
#ifdef _Py_MEMORY_SANITIZER
7979
#include <sanitizer/msan_interface.h>
8080
#endif
8181

@@ -1129,7 +1129,7 @@ PyObject *_ctypes_callproc(PPROC pProc,
11291129
rtype = _ctypes_get_ffi_type(restype);
11301130
resbuf = alloca(max(rtype->size, sizeof(ffi_arg)));
11311131

1132-
#ifdef MEMORY_SANITIZER
1132+
#ifdef _Py_MEMORY_SANITIZER
11331133
/* ffi_call actually initializes resbuf, but from asm, which
11341134
* MemorySanitizer can't detect. Avoid false positives from MSan. */
11351135
if (resbuf != NULL) {

Modules/_posixsubprocess.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <dirent.h>
2222
#endif
2323

24-
#ifdef MEMORY_SANITIZER
24+
#ifdef _Py_MEMORY_SANITIZER
2525
# include <sanitizer/msan_interface.h>
2626
#endif
2727

@@ -291,7 +291,7 @@ _close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep)
291291
sizeof(buffer))) > 0) {
292292
struct linux_dirent64 *entry;
293293
int offset;
294-
#ifdef MEMORY_SANITIZER
294+
#ifdef _Py_MEMORY_SANITIZER
295295
__msan_unpoison(buffer, bytes);
296296
#endif
297297
for (offset = 0; offset < bytes; offset += entry->d_reclen) {

Objects/fileobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define PY_SSIZE_T_CLEAN
44
#include "Python.h"
55

6-
#if defined(HAVE_GETC_UNLOCKED) && !defined(MEMORY_SANITIZER)
6+
#if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER)
77
/* clang MemorySanitizer doesn't yet understand getc_unlocked. */
88
#define GETC(f) getc_unlocked(f)
99
#define FLOCKFILE(f) flockfile(f)

Python/bootstrap_hash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# endif
2121
#endif
2222

23-
#ifdef MEMORY_SANITIZER
23+
#ifdef _Py_MEMORY_SANITIZER
2424
# include <sanitizer/msan_interface.h>
2525
#endif
2626

@@ -147,7 +147,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int blocking, int raise)
147147
else {
148148
n = syscall(SYS_getrandom, dest, n, flags);
149149
}
150-
# ifdef MEMORY_SANITIZER
150+
# ifdef _Py_MEMORY_SANITIZER
151151
if (n > 0) {
152152
__msan_unpoison(dest, n);
153153
}

Python/pymath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ double _Py_force_double(double x)
1717

1818
/* inline assembly for getting and setting the 387 FPU control word on
1919
gcc/x86 */
20-
#ifdef MEMORY_SANITIZER
20+
#ifdef _Py_MEMORY_SANITIZER
2121
__attribute__((no_sanitize_memory))
2222
#endif
2323
unsigned short _Py_get_387controlword(void) {

0 commit comments

Comments
 (0)