8000 Define MEMORY_SANITIZER when appropriate. · python/cpython@dcf57d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit dcf57d4

Browse files
committed
Define MEMORY_SANITIZER when appropriate.
This allows code to easily take conditional action when in an msan build. Usually used for telling msan things it can't otherwise figure out such as syscall, asm behavior, or about libc functions it isn't yet aware of.
1 parent f0184ab commit dcf57d4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Include/Python.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@
5353
#include "pyport.h"
5454
#include "pymacro.h"
5555

56+
/* A convenient way for code to know if clang's memory sanitizer is enabled. */
57+
#if defined(__has_feature)
58+
# if __has_feature(memory_sanitizer)
59+
# if !defined(MEMORY_SANITIZER)
60+
# define MEMORY_SANITIZER
61+
# endif
62+
# endif
63+
#endif
64+
5665
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
5766
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
5867
*/

0 commit comments

Comments
 (0)
0