Author: Aaron Ballman Date: 2026-10-23T15:03:07Z New Revision: 75a53e72d6939bede9df3bc9e73ae05cb314e9e1
URL: https://github.com/llvm/llvm-project/commit/75a53e72d6939bede9df3bc9e73ae05cb314e9e1 DIFF: https://github.com/llvm/llvm-project/commit/75a53e72d6939bede9df3bc9e73ae05cb314e9e1.diff LOG: [clang][C2y] Claim support for WG14 N3842 (#234956) This requires no updates to the compiler; the paper clarified that standard headers do not need to be included before you can use the pragmas. That's behavior Clang has always supported, even if we don't support all of the pragmas listed in the paper currently. Added: clang/test/C/C2y/n3842.c Modified: clang/www/c_status.html Removed: ################################################################################ diff --git a/clang/test/C/C2y/n3842.c b/clang/test/C/C2y/n3842.c new file mode 100644 index 0000000000000..f653d50bc6433 --- /dev/null +++ b/clang/test/C/C2y/n3842.c @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s + +/* WG14 N3842: Yes + * Standard pragmas and headers + * + * The standard showed #include <complex.h> before the pragmas and that + * suggested these require header support. This paper clarified that you do not + * need to include any headers to use standard pragmas that have component + * which look like macros. e.g., ON, OFF, DEFAULT, CX_LIMITED_RANGE, etc. + * + * We claim full support because none of the pragmas are giving errors about + * use of unknown identifiers. However, Clang doesn't currently support + * rounding mode pragmas or DFP, so some diagnostics are expected. + */ + +#pragma STDC CX_LIMITED_RANGE ON +#pragma STDC CX_LIMITED_RANGE OFF +#pragma STDC CX_LIMITED_RANGE DEFAULT + +#pragma STDC FENV_ACCESS ON +#pragma STDC FENV_ACCESS OFF +#pragma STDC FENV_ACCESS DEFAULT + +// Clang does not support rounding modes at all currently, so these are +// expected to warn as being unsupported. +#pragma STDC FENV_ROUND FE_DOWNWARD // expected-warning {{pragma STDC FENV_ROUND is not supported}} +#pragma STDC FENV_ROUND FE_TONEAREST // expected-warning {{pragma STDC FENV_ROUND is not supported}} +#pragma STDC FENV_ROUND FE_TONEARESTFROMZERO // expected-warning {{pragma STDC FENV_ROUND is not supported}} +#pragma STDC FENV_ROUND FE_TOWARDZERO // expected-warning {{pragma STDC FENV_ROUND is not supported}} +#pragma STDC FENV_ROUND FE_UPWARD // expected-warning {{pragma STDC FENV_ROUND is not supported}} +#pragma STDC FENV_ROUND FE_DYNAMIC // expected-warning {{pragma STDC FENV_ROUND is not supported}} + +// Clang does not support decimal floating point yet, so these are expected to +// warn as unknown pragmas. +#pragma STDC FENV_DEC_ROUND FE_DEC_DOWNWARD // expected-warning {{unknown pragma in STDC namespace}} +#pragma STDC FENV_DEC_ROUND FE_DEC_TONEAREST // expected-warning {{unknown pragma in STDC namespace}} +#pragma STDC FENV_DEC_ROUND FE_DEC_TONEARESTFROMZERO // expected-warning {{unknown pragma in STDC namespace}} +#pragma STDC FENV_DEC_ROUND FE_DEC_TOWARDZERO // expected-warning {{unknown pragma in STDC namespace}} +#pragma STDC FENV_DEC_ROUND FE_DEC_UPWARD // expected-warning {{unknown pragma in STDC namespace}} +#pragma STDC FENV_DEC_ROUND FE_DEC_DYNAMIC // expected-warning {{unknown pragma in STDC namespace}} + +#pragma STDC FP_CONTRACT ON +#pragma STDC FP_CONTRACT OFF +#pragma STDC FP_CONTRACT DEFAULT + diff --git a/clang/www/c_status.html b/clang/www/c_status.html index 82898f7761127..0408987715c98 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -437,7 +437,7 @@ <h2 id="c2y">C2y implementation status</h2> <tr> <td>Standard pragmas and headers</td> <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3842.pdf">N3842</a></td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr> <td>Conflicting requirements for double_t</td> _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
