summaryrefslogtreecommitdiffstats
path: root/Include/pyport.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-04 15:48:05 (GMT)
committerGitHub <noreply@github.com>2019-05-04 15:48:05 (GMT)
commitc664b342a47e4b4650706d07e3e40a295e3a4407 (patch)
tree960378ef676a7dc621be03f0b7744ce73a0948c0 /Include/pyport.h
parent6b5b013bcc22a27d6231c2796882e44ddb42be67 (diff)
downloadcpython-c664b342a47e4b4650706d07e3e40a295e3a4407.zip
cpython-c664b342a47e4b4650706d07e3e40a295e3a4407.tar.gz
cpython-c664b342a47e4b4650706d07e3e40a295e3a4407.tar.bz2
bpo-36475: Make PyThread_exit_thread with _Py_NO_RETURN (GH-13068)
Diffstat (limited to 'Include/pyport.h')
-rw-r--r--Include/pyport.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index 97fb5e5..ab88a9a 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -829,4 +829,18 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
# define _Py_FORCE_UTF8_FS_ENCODING
#endif
+/* Mark a function which cannot return. Example:
+
+ PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void); */
+#if defined(__clang__) || \
+ (defined(__GNUC__) && \
+ ((__GNUC__ >= 3) || \
+ (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5)))
+# define _Py_NO_RETURN __attribute__((__noreturn__))
+#elif defined(_MSC_VER)
+# define _Py_NO_RETURN __declspec(noreturn)
+#else
+# define _Py_NO_RETURN
+#endif
+
#endif /* Py_PYPORT_H */