summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2018-11-13 06:01:22 (GMT)
committerGitHub <noreply@github.com>2018-11-13 06:01:22 (GMT)
commit3015fb8ce4d25603434b9b44bb7effb98a481532 (patch)
treea76d3bbd890685a151c19b48bd5d8346eb7e7276
parent0dc1e45dfd242493ecdac5dbcad51dbc8f922de7 (diff)
downloadcpython-3015fb8ce4d25603434b9b44bb7effb98a481532.zip
cpython-3015fb8ce4d25603434b9b44bb7effb98a481532.tar.gz
cpython-3015fb8ce4d25603434b9b44bb7effb98a481532.tar.bz2
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
-rw-r--r--Include/Python.h4
-rw-r--r--Modules/_ctypes/callproc.c4
-rw-r--r--Modules/_posixsubprocess.c4
-rw-r--r--Objects/fileobject.c2
-rw-r--r--Python/bootstrap_hash.c4
-rw-r--r--Python/pymath.c2
6 files changed, 10 insertions, 10 deletions
diff --git a/Include/Python.h b/Include/Python.h
index bece208..cb24c8d 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -56,8 +56,8 @@
/* A convenient way for code to know if clang's memory sanitizer is enabled. */
#if defined(__has_feature)
# if __has_feature(memory_sanitizer)
-# if !defined(MEMORY_SANITIZER)
-# define MEMORY_SANITIZER
+# if !defined(_Py_MEMORY_SANITIZER)
+# define _Py_MEMORY_SANITIZER
# endif
# endif
#endif
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 33b7055..d485c58 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -75,7 +75,7 @@
#include <alloca.h>
#endif
-#ifdef MEMORY_SANITIZER
+#ifdef _Py_MEMORY_SANITIZER
#include <sanitizer/msan_interface.h>
#endif
@@ -1129,7 +1129,7 @@ PyObject *_ctypes_callproc(PPROC pProc,
rtype = _ctypes_get_ffi_type(restype);
resbuf = alloca(max(rtype->size, sizeof(ffi_arg)));
-#ifdef MEMORY_SANITIZER
+#ifdef _Py_MEMORY_SANITIZER
/* ffi_call actually initializes resbuf, but from asm, which
* MemorySanitizer can't detect. Avoid false positives from MSan. */
if (resbuf != NULL) {
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
index 7ee3f71..2b2c57d 100644
--- a/Modules/_posixsubprocess.c
+++ b/Modules/_posixsubprocess.c
@@ -21,7 +21,7 @@
#include <dirent.h>
#endif
-#ifdef MEMORY_SANITIZER
+#ifdef _Py_MEMORY_SANITIZER
# include <sanitizer/msan_interface.h>
#endif
@@ -291,7 +291,7 @@ _close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep)
sizeof(buffer))) > 0) {
struct linux_dirent64 *entry;
int offset;
-#ifdef MEMORY_SANITIZER
+#ifdef _Py_MEMORY_SANITIZER
__msan_unpoison(buffer, bytes);
#endif
for (offset = 0; offset < bytes; offset += entry->d_reclen) {
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 10e8391..313f1d0 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -3,7 +3,7 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#if defined(HAVE_GETC_UNLOCKED) && !defined(MEMORY_SANITIZER)
+#if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER)
/* clang MemorySanitizer doesn't yet understand getc_unlocked. */
#define GETC(f) getc_unlocked(f)
#define FLOCKFILE(f) flockfile(f)
diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c
index 1b8f9d9..793c646 100644
--- a/Python/bootstrap_hash.c
+++ b/Python/bootstrap_hash.c
@@ -20,7 +20,7 @@
# endif
#endif
-#ifdef MEMORY_SANITIZER
+#ifdef _Py_MEMORY_SANITIZER
# include <sanitizer/msan_interface.h>
#endif
@@ -147,7 +147,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int blocking, int raise)
else {
n = syscall(SYS_getrandom, dest, n, flags);
}
-# ifdef MEMORY_SANITIZER
+# ifdef _Py_MEMORY_SANITIZER
if (n > 0) {
__msan_unpoison(dest, n);
}
diff --git a/Python/pymath.c b/Python/pymath.c
index c1606bd..24b8042 100644
--- a/Python/pymath.c
+++ b/Python/pymath.c
@@ -17,7 +17,7 @@ double _Py_force_double(double x)
/* inline assembly for getting and setting the 387 FPU control word on
gcc/x86 */
-#ifdef MEMORY_SANITIZER
+#ifdef _Py_MEMORY_SANITIZER
__attribute__((no_sanitize_memory))
#endif
unsigned short _Py_get_387controlword(void) {