Skip to content

Commit 634b8e8

Browse files
committed
[Clang] Document some of the implementation-defined keywords
1 parent dc567a2 commit 634b8e8

File tree

1 file changed

+111
-11
lines changed

1 file changed

+111
-11
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 111 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,117 @@ __datasizeof
433433
``__datasizeof`` behaves like ``sizeof``, except that it returns the size of the
434434
type ignoring tail padding.
435435

436+
_BitInt, _ExtInt
437+
----------------
438+
439+
Clang supports the C23 ``_BitInt(N)`` feature as an extension in older C modes
440+
and in C++. This type was previously implemented in Clang with the same
441+
semantics, but spelled ``_ExtInt(N)``. This spelling has been deprecated in
442+
favor of the standard type.
443+
444+
Note: the ABI for ``_BitInt(N)`` is still in the process of being stabilized,
445+
so this type should not yet be used in interfaces that require ABI stability.
446+
447+
C keywords supported in all language modes
448+
------------------------------------------
449+
450+
Clang supports ``_Alignas``, ``_Alignof``, ``_Atomic``, ``_Complex``,
451+
``_Generic``, ``_Imaginary``, ``_Noreturn``, ``_Static_assert``,
452+
``_Thread_local``, ``_Float16``, ``_Decimal32``, ``_Decimal64`` and
453+
``_Decimal128`` in all language modes with the C semantics.
454+
455+
__alignof, __alignof__
456+
----------------------
457+
458+
``__alignof`` and ``__alignof__`` return, in contrast to ``_Alignof`` and
459+
``alignof``, the preferred alignment of a type. This may be larger than the
460+
required alignment for improved performance.
461+
462+
__extension__
463+
-------------
464+
465+
``__extension__`` suppressed extension diagnostics in the statement it is
466+
prepended to.
467+
468+
__auto_type
469+
-----------
470+
471+
``__auto_type`` behaves the same as C++11s ``auto`` but is available in all
472+
language modes.
473+
474+
__imag, __imag__
475+
----------------
476+
477+
``__imag`` and ``__imag__`` can be used to get the imaginary part of a complex
478+
value.
479+
480+
__real, __real__
481+
----------------
482+
483+
``__real`` and ``__real__`` can be used to get the real part of a complex value.
484+
485+
__asm, __asm__
486+
--------------
487+
488+
``__asm`` and ``__asm__`` are alternate spellings for ``asm``, but available in
489+
all language modes.
490+
491+
__complex, __complex__
492+
----------------------
493+
494+
``__complex`` and ``__complex__`` are alternate spellings for ``_Complex``.
495+
496+
__const, __const__
497+
------------------
498+
499+
``__const`` and ``__const__`` are alternate spellings for ``const``.
500+
501+
__decltype
502+
----------
503+
504+
``__decltype`` is an alternate spelling for ``decltype``, but is also available
505+
in C++ modes before C++11.
506+
507+
__inline, __inline__
508+
--------------------
509+
510+
``__inline`` and ``__inline__`` are alternate spellings for ``inline``, but are
511+
available in all language modes.
512+
513+
__nullptr
514+
---------
515+
516+
``__nullptr`` is an alternate spelling for ``nullptr``, but is also available in
517+
C++ modes before C++11.
518+
519+
__restrict, __restrict__
520+
------------------------
521+
522+
``__restrict`` and ``__restrict__`` are alternate spellings for ``restrict``,
523+
but are available in all language modes.
524+
525+
__signed, __signed__
526+
--------------------
527+
528+
``__signed`` and ``__signed__`` are alternate spellings for ``signed``.
529+
530+
__typeof, __typeof__
531+
--------------------
532+
533+
``__typeof`` and ``__typeof__`` are alternate spellings for ``typeof``, but are
534+
available in all langauge modes.
535+
536+
__volatile, __volatile__
537+
------------------------
538+
539+
``__volatile`` and ``__volatile__`` are alternate spellings for ``volatile``.
540+
541+
__char16_t, __char32_t
542+
----------------------
543+
544+
``__char16_t`` and ``__char32_t`` are alternate spellings for ``char16_t`` and
545+
``char32_t`` respectively, but are also available in C++ modes before C++11.
546+
436547
..
437548
FIXME: This should list all the keyword extensions
438549
@@ -5319,17 +5430,6 @@ Examples are:
53195430
# 60 "" 2 // return to "main.c"
53205431
# 1 "/usr/ancient/header.h" 1 4 // Enter an implicit extern "C" header
53215432
5322-
Extended Integer Types
5323-
======================
5324-
5325-
Clang supports the C23 ``_BitInt(N)`` feature as an extension in older C modes
5326-
and in C++. This type was previously implemented in Clang with the same
5327-
semantics, but spelled ``_ExtInt(N)``. This spelling has been deprecated in
5328-
favor of the standard type.
5329-
5330-
Note: the ABI for ``_BitInt(N)`` is still in the process of being stabilized,
5331-
so this type should not yet be used in interfaces that require ABI stability.
5332-
53335433
Intrinsics Support within Constant Expressions
53345434
==============================================
53355435

0 commit comments

Comments
 (0)