]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 13 Nov 2018 06:27:05 +0000 (22:27 -0800)
committerGitHub <noreply@github.com>
Tue, 13 Nov 2018 06:27:05 +0000 (22:27 -0800)
Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER.
Project based C Preprocessor namespacing at its finest. :P
(cherry picked from commit 3015fb8ce4d25603434b9b44bb7effb98a481532)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Include/Python.h
Modules/_ctypes/callproc.c
Modules/_posixsubprocess.c
Objects/fileobject.c
Python/pymath.c
Python/random.c

index 565f34a371f543ba008ca155a5f96e8fa83626b7..bf1dfac06763b71e5db4ec551d81ef1c94025fc9 100644 (file)
@@ -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
index 0e1f065e19a4eec5ab92dea9e6eba273bcdb6dee..e6079e9938ceca372c52cb1cd524bcf5faa86a2a 100644 (file)
@@ -75,7 +75,7 @@
 #include <alloca.h>
 #endif
 
-#ifdef MEMORY_SANITIZER
+#ifdef _Py_MEMORY_SANITIZER
 #include <sanitizer/msan_interface.h>
 #endif
 
@@ -1140,7 +1140,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) {
index fe519dea9c5475724dfaaf32862106b8cc466da7..07dd54dba94c32f743c6673f5f5f1a887f063e3b 100644 (file)
@@ -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) {
index f4944da4fccea0d1c6ad4e52a023d2c6b766a3e7..f8b47fcdce5c03cabfc7a57d8d1fb38914ed72ef 100644 (file)
@@ -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)
index c1606bd6d1da4003f5a14ec1fcfce12404d5e9a3..24b804223eef19a9e551d6916ea1230f7bfd7644 100644 (file)
@@ -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) {
index 8f6670457f3ffdd628363e018fe8a0be8104956f..d4747d61eb8605800f2e3d1fa89bf618daf49516 100644 (file)
@@ -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);
         }