|
32 | 32 |
|
33 | 33 | #define PUTS(fd, str) _Py_write_noraise(fd, str, strlen(str)) |
34 | 34 |
|
| 35 | + |
| 36 | +// clang uses __attribute__((no_sanitize("undefined"))) |
| 37 | +// GCC 4.9+ uses __attribute__((no_sanitize_undefined)) |
| 38 | +#if defined(__has_feature) // Clang |
| 39 | +# if __has_feature(undefined_behavior_sanitizer) |
| 40 | +# define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) |
| 41 | +# endif |
| 42 | +#endif |
| 43 | +#if defined(__GNUC__) \ |
| 44 | + && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) |
| 45 | +# define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined)) |
| 46 | +#endif |
| 47 | +#ifndef _Py_NO_SANITIZE_UNDEFINED |
| 48 | +# define _Py_NO_SANITIZE_UNDEFINED |
| 49 | +#endif |
| 50 | + |
| 51 | + |
35 | 52 | #ifdef HAVE_SIGACTION |
36 | 53 | typedef struct sigaction _Py_sighandler_t; |
37 | 54 | #else |
@@ -1013,7 +1030,7 @@ faulthandler_suppress_crash_report(void) |
1013 | 1030 | #endif |
1014 | 1031 | } |
1015 | 1032 |
|
1016 | | -static PyObject * |
| 1033 | +static PyObject* _Py_NO_SANITIZE_UNDEFINED |
1017 | 1034 | faulthandler_read_null(PyObject *self, PyObject *args) |
1018 | 1035 | { |
1019 | 1036 | volatile int *x; |
@@ -1102,21 +1119,6 @@ faulthandler_fatal_error_c_thread(PyObject *self, PyObject *args) |
1102 | 1119 | Py_RETURN_NONE; |
1103 | 1120 | } |
1104 | 1121 |
|
1105 | | -// clang uses __attribute__((no_sanitize("undefined"))) |
1106 | | -// GCC 4.9+ uses __attribute__((no_sanitize_undefined)) |
1107 | | -#if defined(__has_feature) // Clang |
1108 | | -# if __has_feature(undefined_behavior_sanitizer) |
1109 | | -# define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) |
1110 | | -# endif |
1111 | | -#endif |
1112 | | -#if defined(__GNUC__) \ |
1113 | | - && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) |
1114 | | -# define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined)) |
1115 | | -#endif |
1116 | | -#ifndef _Py_NO_SANITIZE_UNDEFINED |
1117 | | -# define _Py_NO_SANITIZE_UNDEFINED |
1118 | | -#endif |
1119 | | - |
1120 | 1122 | static PyObject* _Py_NO_SANITIZE_UNDEFINED |
1121 | 1123 | faulthandler_sigfpe(PyObject *self, PyObject *args) |
1122 | 1124 | { |
|
0 commit comments