Skip to content

Commit

Permalink
[C23] Update user-facing docs for C23
Browse files Browse the repository at this point in the history
This changes some public references of C2x to be C23, corrects standard
citations to use the final paragraph numbers, and adds some information
about differences between C17 and C23 modes.
  • Loading branch information
AaronBallman committed Aug 10, 2023
1 parent 9c135f1 commit 315d1d0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
8 changes: 4 additions & 4 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ to perform additional operations on certain scalar and vector types.

Let ``T`` be one of the following types:

* an integer type (as in C2x 6.2.5p19), but excluding enumerated types and _Bool
* an integer type (as in C23 6.2.5p22), but excluding enumerated types and ``bool``
* the standard floating types float or double
* a half-precision floating point type, if one is supported on the target
* a vector type.
Expand Down Expand Up @@ -1462,8 +1462,8 @@ Conditional ``explicit`` __cpp_conditional_explicit C++20
``static operator()`` __cpp_static_call_operator C++23 C++03
-------------------------------------- -------------------------------- ------------- -------------
Designated initializers (N494) C99 C89
Array & element qualification (N2607) C2x C89
Attributes (N2335) C2x C89
Array & element qualification (N2607) C23 C89
Attributes (N2335) C23 C89
====================================== ================================ ============= =============

Type Trait Primitives
Expand Down Expand Up @@ -3669,7 +3669,7 @@ A predefined typedef for the target-specific ``va_list`` type.
A builtin function for the target-specific ``va_start`` function-like macro.
The ``parameter-name`` argument is the name of the parameter preceding the
ellipsis (``...``) in the function signature. Alternatively, in C2x mode or
ellipsis (``...``) in the function signature. Alternatively, in C23 mode or
later, it may be the integer literal ``0`` if there is no parameter preceding
the ellipsis. This function initializes the given ``__builtin_va_list`` object.
It is undefined behavior to call this function on an already initialized
Expand Down
4 changes: 2 additions & 2 deletions clang/docs/MatrixTypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ program is ill-formed.
Currently, the element type of a matrix is only permitted to be one of the
following types:

* an integer type (as in C2x 6.2.5p19), but excluding enumerated types and ``_Bool``
* an integer type (as in C23 6.2.5p22), but excluding enumerated types and ``bool``
* the standard floating types ``float`` or ``double``
* a half-precision floating point type, if one is supported on the target

Expand Down Expand Up @@ -68,7 +68,7 @@ rows and columns are the same and the value's elements can be converted to the
element type of the result type. The result is a matrix where each element is
the converted corresponding element.

A value of any real type (as in C2x 6.2.5p17) can be converted to a matrix type
A value of any real type (as in C23 6.2.5p14) can be converted to a matrix type
if it can be converted to the element type of the matrix. The result is a
matrix where all elements are the converted original value.

Expand Down
2 changes: 1 addition & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ C Language Changes
constant expressions. This change is more consistent with the behavior of
GCC.

C2x Feature Support
C23 Feature Support
^^^^^^^^^^^^^^^^^^^
- Clang now accepts ``-std=c23`` and ``-std=gnu23`` as language standard modes,
and the ``__STDC_VERSION__`` macro now expands to ``202311L`` instead of its
Expand Down
15 changes: 14 additions & 1 deletion clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,7 @@ Differences between various standard modes

clang supports the -std option, which changes what language mode clang uses.
The supported modes for C are c89, gnu89, c94, c99, gnu99, c11, gnu11, c17,
gnu17, c2x, gnu2x, and various aliases for those modes. If no -std option is
gnu17, c23, gnu23, and various aliases for those modes. If no -std option is
specified, clang defaults to gnu17 mode. Many C99 and C11 features are
supported in earlier modes as a conforming extension, with a warning. Use
``-pedantic-errors`` to request an error if a feature from a later standard
Expand Down Expand Up @@ -3224,6 +3224,19 @@ Differences between ``*11`` and ``*17`` modes:

- ``__STDC_VERSION__`` is defined to ``201710L`` rather than ``201112L``.

Differences between ``*17`` and ``*23`` modes:

- ``__STDC_VERSION__`` is defined to ``202311L`` rather than ``201710L``.
- ``nullptr`` and ``nullptr_t`` are supported, only in ``*23`` mode.
- ``ATOMIC_VAR_INIT`` is removed from ``*23`` mode.
- ``bool``, ``true``, ``false``, ``alignas``, ``alignof``, ``static_assert``,
and ``thread_local` are now first-class keywords, only in ``*23`` mode.
- ``typeof`` and ``typeof_unqual`` are supported, only ``*23`` mode.
- Bit-precise integers (``_BitInt(N)``) are supported by default in ``*23``
mode, and as an extension in ``*17`` and earlier modes.
- ``[[]]`` attributes are supported by default in ``*23`` mode, and as an
extension in ``*17`` and earlier modes.

GCC extensions not implemented yet
----------------------------------

Expand Down

0 comments on commit 315d1d0

Please sign in to comment.