Skip to content

Commit 56167d0

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

File tree

1 file changed

+103
-11
lines changed

1 file changed

+103
-11
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 103 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,109 @@ __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``, and ``_Float16`` in all language modes with the C semantics.
453+
454+
__alignof, __alignof__
455+
----------------------
456+
457+
``__alignof`` and ``__alignof__`` return, in contrast to ``_Alignof`` and
458+
``alignof``, the preferred alignment of a type. This may be larger than the
459+
required alignment for improved performance.
460+
461+
__extension__
462+
-------------
463+
464+
``__extension__`` suppresses extension diagnostics in the statement it is
465+
prepended to.
466+
467+
__auto_type
468+
-----------
469+
470+
``__auto_type`` behaves the same as ``auto`` in C++11 but is available in all
471+
language modes.
472+
473+
__imag, __imag__
474+
----------------
475+
476+
``__imag`` and ``__imag__`` can be used to get the imaginary part of a complex
477+
value.
478+
479+
__real, __real__
480+
----------------
481+
482+
``__real`` and ``__real__`` can be used to get the real part of a complex value.
483+
484+
__asm, __asm__
485+
--------------
486+
487+
``__asm`` and ``__asm__`` are alternate spellings for ``asm``, but available in
488+
all language modes.
489+
490+
__complex, __complex__
491+
----------------------
492+
493+
``__complex`` and ``__complex__`` are alternate spellings for ``_Complex``.
494+
495+
__const, __const__, __volatile, __volatile__, __restrict, __restrict__
496+
----------------------------------------------------------------------
497+
498+
These are alternate spellings for their non-underscore counterparts, but are
499+
available in all langauge modes.
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 prior to C++11. Note that it's currently not availbale in C despite
518+
C23 having support for ``nullptr``.
519+
520+
__signed, __signed__
521+
--------------------
522+
523+
``__signed`` and ``__signed__`` are alternate spellings for ``signed``.
524+
``__unsigned`` and ``__unsigned__`` are **not** supported.
525+
526+
__typeof, __typeof__
527+
--------------------
528+
529+
``__typeof`` and ``__typeof__`` are alternate spellings for ``typeof``, but are
530+
available in all langauge modes.
531+
532+
__char16_t, __char32_t
533+
----------------------
534+
535+
``__char16_t`` and ``__char32_t`` are alternate spellings for ``char16_t`` and
536+
``char32_t`` respectively, but are also available in C++ modes before C++11.
537+
They are only supported in C++. ``__char8_t`` is not available.
538+
436539
..
437540
FIXME: This should list all the keyword extensions
438541
@@ -5319,17 +5422,6 @@ Examples are:
53195422
# 60 "" 2 // return to "main.c"
53205423
# 1 "/usr/ancient/header.h" 1 4 // Enter an implicit extern "C" header
53215424
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-
53335425
Intrinsics Support within Constant Expressions
53345426
==============================================
53355427

0 commit comments

Comments
 (0)