summaryrefslogtreecommitdiffstats
path: root/Include/pyport.h
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2023-05-04 07:56:53 (GMT)
committerGitHub <noreply@github.com>2023-05-04 07:56:53 (GMT)
commitcd9a56c2b0e14f56f2e83dd4db43c5c69a74b232 (patch)
treeff971ebbdb11701bab003d743a6d5b928c35184f /Include/pyport.h
parent35d273825abc319d0ecbd69110e847f6040d0cd7 (diff)
downloadcpython-cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232.zip
cpython-cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232.tar.gz
cpython-cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232.tar.bz2
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Include/pyport.h')
-rw-r--r--Include/pyport.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index bd0ba6d..d7c6ae6 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -765,4 +765,15 @@ extern char * _getpty(int *, int, mode_t, int);
#undef __bool__
#endif
+// Make sure we have maximum alignment, even if the current compiler
+// does not support max_align_t. Note that:
+// - Autoconf reports alignment of unknown types to 0.
+// - 'long double' has maximum alignment on *most* platforms,
+// looks like the best we can do for pre-C11 compilers.
+// - The value is tested, see test_alignof_max_align_t
+#if !defined(ALIGNOF_MAX_ALIGN_T) || ALIGNOF_MAX_ALIGN_T == 0
+# undef ALIGNOF_MAX_ALIGN_T
+# define ALIGNOF_MAX_ALIGN_T _Alignof(long double)
+#endif
+
#endif /* Py_PYPORT_H */