[PATCH] D97912: [doc] Document that __fp16 will apply default argument promotion rule.

Kito Cheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 3 22:42:23 PST 2021


kito-cheng created this revision.
kito-cheng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

ACLE didn't specify the default argument promotion rule on __fp16, but
the current implementation both on GCC and clang are applied default
argument promotion rule on __fp16, so I think it should document that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97912

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===================================================================
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -569,12 +569,13 @@
 ``3.14f16``.
 
 Because default argument promotion only applies to the standard floating-point
-types, ``_Float16`` values are not promoted to ``double`` when passed as variadic
-or untyped arguments.  As a consequence, some caution must be taken when using
-certain library facilities with ``_Float16``; for example, there is no ``printf`` format
-specifier for ``_Float16``, and (unlike ``float``) it will not be implicitly promoted to
-``double`` when passed to ``printf``, so the programmer must explicitly cast it to
-``double`` before using it with an ``%f`` or similar specifier.
+types and ``__fp16``, ``_Float16`` values are not promoted to ``double`` when
+passed as variadic or untyped arguments.  As a consequence, some caution must
+be taken when using certain library facilities with ``_Float16``; for example,
+there is no ``printf`` format specifier for ``_Float16``, and (unlike ``float``)
+it will not be implicitly promoted to ``double`` when passed to ``printf``, so
+the programmer must explicitly cast it to ``double`` before using it with an
+``%f`` or similar specifier.
 
 Messages on ``deprecated`` and ``unavailable`` Attributes
 =========================================================


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97912.328027.patch
Type: text/x-patch
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210304/670e4e99/attachment.bin>


More information about the cfe-commits mailing list