gh-146175: Soft-deprecate outdated macros; convert internal usage (GH… · python/cpython@91cd2e5

GitHub

@@ -526,14 +526,26 @@ to the C language.

526526Outdated macros

527527---------------

528528529-The following macros have been used to features that have been standardized

530-in C11.

529+The following :term:`soft deprecated` macros have been used to features that

530+have been standardized in C11 (or previous standards).

531531532532.. c:macro:: Py_ALIGNED(num)

533533534- Specify alignment to *num* bytes on compilers that support it.

534+ On some GCC-like compilers, specify alignment to *num* bytes.

535+ This does nothing on other compilers.

535536536- Consider using the C11 standard ``_Alignas`` specifier over this macro.

537+ Use the standard ``alignas`` specifier rather than this macro.

538+539+ .. deprecated:: next

540+ The macro is :term:`soft deprecated`.

541+542+.. c:macro::PY_FORMAT_SIZE_T

543+544+ The :c:func:`printf` formatting modifier for :c:type:`size_t`.

545+ Use ``"z"`` directly instead.

546+547+ .. deprecated:: next

548+ The macro is :term:`soft deprecated`.

537549538550.. c:macro:: Py_LL(number)

539551Py_ULL(number)

@@ -546,6 +558,38 @@ in C11.

546558547559 Consider using the C99 standard suffixes ``LL`` and ``LLU`` directly.

548560561+ .. deprecated:: next

562+ The macro is :term:`soft deprecated`.

563+564+.. c:macro:: PY_LONG_LONG

565+ PY_INT32_T

566+ PY_UINT32_T

567+ PY_INT64_T

568+ PY_UINT64_T

569+570+ Aliases for the types :c:type:`!long long`, :c:type:`!int32_t`,

571+ :c:type:`!uint32_t`. :c:type:`!int64_t` and :c:type:`!uint64_t`,

572+ respectively.

573+ Historically, these types needed compiler-specific extensions.

574+575+ .. deprecated:: next

576+ These macros are :term:`soft deprecated`.

577+578+.. c:macro:: PY_LLONG_MIN

579+ PY_LLONG_MAX

580+ PY_ULLONG_MAX

581+ PY_SIZE_MAX

582+583+ Aliases for the values :c:macro:`!LLONG_MIN`, :c:macro:`!LLONG_MAX`,

584+ :c:macro:`!ULLONG_MAX`, and :c:macro:`!SIZE_MAX`, respectively.

585+ Use these standard names instead.

586+587+ The required header, ``<limits.h>``,

588+ :ref:`is included <capi-system-includes>` in ``Python.h``.

589+590+ .. deprecated:: next

591+ These macros are :term:`soft deprecated`.

592+549593.. c:macro:: Py_MEMCPY(dest, src, n)

550594551595 This is a :term:`soft deprecated` alias to :c:func:`!memcpy`.

@@ -554,6 +598,25 @@ in C11.

554598 .. deprecated:: 3.14

555599 The macro is :term:`soft deprecated`.

556600601+.. c:macro:: Py_UNICODE_SIZE

602+603+ Size of the :c:type:`!wchar_t` type.

604+ Use ``sizeof(wchar_t)`` or ``WCHAR_WIDTH/8`` instead.

605+606+ The required header for the latter, ``<limits.h>``,

607+ :ref:`is included <capi-system-includes>` in ``Python.h``.

608+609+ .. deprecated:: next

610+ The macro is :term:`soft deprecated`.

611+612+.. c:macro:: Py_UNICODE_WIDE

613+614+ Defined if ``wchar_t`` can hold a Unicode character (UCS-4).

615+ Use ``sizeof(wchar_t) >= 4`` instead

616+617+ .. deprecated:: next

618+ The macro is :term:`soft deprecated`.

619+557620.. c:macro:: Py_VA_COPY

558621559622 This is a :term:`soft deprecated` alias to the C99-standard ``va_copy``

@@ -564,6 +627,9 @@ in C11.

564627 .. versionchanged:: 3.6

565628 This is now an alias to ``va_copy``.

566629630+ .. deprecated:: next

631+ The macro is :term:`soft deprecated`.

632+567633568634.. _api-objects:

569635