C Support in Clang
Clang implements the following published and upcoming ISO C standards:
Language Standard | Flag | Available in Clang? |
---|---|---|
C89 | -std=c89 | Yes |
C99 | -std=c99 | Almost certainly |
C11 | -std=c11 | Probably |
C17 | -std=c17 | Maybe? |
C2x | -std=c2x | Partial |
The implementation status for C99, C11, and C17 are currently under investigation. Any proposal whose status in Clang is currently unknown will be marked in magenta.
The Clang community is continually striving to improve C standards compliance between releases. We implement the resolution for defect reports, but we do not currently track our DR status (help with tracking DR status is appreciated).
The LLVM bug tracker contains a Clang C component that tracks known bugs with Clang's language conformance.
C89 implementation status
Clang implements all of the ISO 9899:1990 (C89) standard.
You can use Clang in C89 mode with the -std=c89
or -std=c90
options.
C99 implementation status
Clang implements a significant portion of the ISO 9899:1999 (C99) standard, but the status of individual proposals is still under investigation.
You can use Clang in C99 mode with the -std=c99
option.
C11 implementation status
Clang implements a significant portion of the ISO 9899:2011 (C11) standard, but the status of individual proposals is still under investigation.
You can use Clang in C11 mode with the -std=c11
option (use -std=c1x
in Clang 3.0 and earlier).
List of features and minimum Clang version with support
Language Feature | C11 Proposal | Available in Clang? |
---|---|---|
A finer-grained specification for sequencing | N1252 | Unknown |
Clarification of expressions | N1282 | Unknown |
Extending the lifetime of temporary objects (factored approach) | N1285 | Unknown |
Requiring signed char to have no padding bits | N1310 | Unknown |
Initializing static or external variables | N1311 | Unknown |
Conversion between pointers and floating types | N1316 | Yes |
Adding TR 19769 to the C Standard Library | N1326 | Clang 3.3 |
Static assertions | N1330 | Yes |
Parallel memory sequencing model proposal | N1349 | Unknown |
Analyzability (#1, #4 - conditionally normative) | N1350 | Unknown |
FLT_EVAL_METHOD issues (first change only) | N1353 | Unknown |
_Bool bit-fields | N1356 | Unknown |
Technical corrigendum for C1X | N1359 | Unknown |
Benign typedef redefinition | N1360 | Clang 3.1 |
Thread-local storage | N1364 | Clang 3.3 |
Constant expressions | N1365 | Unknown |
Contractions and expression evaluation methods | N1367 | Unknown |
FLT_EVAL_METHOD and return | N1382 | Unknown |
Floating-point to int/_Bool conversions | N1391 | Unknown |
Analyzability (along the lines) | N1394 | Unknown |
Wide function returns (alternate proposal) | N1396 | Unknown |
Alignment | ||
N1397 | Clang 3.2 | |
N1447 | Clang 3.2 | |
Anonymous member-structures and unions (modulo "name lookup") | N1406 | Yes |
Completeness of types | N1439 | Unknown |
Generic macro facility | N1441 | Yes |
Dependency ordering for C memory model | N1444 | Unknown |
Subsetting the standard | N1460 | Unknown |
Assumed types in F.9.2 | N1468 | Unknown |
Supporting the 'noreturn' property in C1x | N1478 | Clang 3.3 |
Updates to C++ memory model based on formalization | N1480 | Unknown |
Explicit initializers for atomics | N1482 | Unknown |
Atomics proposal (minus ternary op) | N1485 | Yes |
UTF-8 string literals | N1488 | Clang 3.3 |
Optimizing away infinite loops | N1509 | Yes |
Conditional normative status for Annex G | N1514 | Unknown |
Creation of complex value | N1464 | Unknown |
Recommendations for extended identifier characters for C and C++ | N1518 | Unknown |
Atomic C1x/C++0x compatibility refinements (1st part only) | N1526 | Yes |
Atomic bitfields implementation defined | N1530 | Yes |
Small fix for the effect of alignment on struct/union type compatibility | N1532 | Yes |
Synthesis re _Atomic | N1537 | Unknown |
Clarification for wide evaluation | N1531 | Unknown |
C17 implementation status
There are no major changes in this edition, only technical corrections and clarifications that are tracked by Defect Report.
You can use Clang in C17 mode with the -std=c17
or -std=c18
options (available in Clang 6 and later).
C2x implementation status
Clang has support for some of the features of the C standard following C17, informally referred to as C2x.
You can use Clang in C2x mode with the -std=c2x
option (available in Clang 9 and later).
List of features and minimum Clang version with support
Language Feature | C2x Proposal | Available in Clang? |
---|---|---|
Evaluation formats | N2186 | Unknown |
Clarifying the restrict Keyword v2 | N2660 | Unknown |
Harmonizing static_assert with C++ | N2665 | Clang 9 |
nodiscard attribute | N2667 | Clang 9 |
maybe_unused attribute | N2670 | Clang 9 |
TS 18661 Integration | ||
N2314 | Unknown | |
N2341 | Unknown | |
N2401 | Unknown | |
N2359 | Unknown | |
N2546 | Unknown | |
Preprocessor line numbers unspecified | N2322 | Yes |
deprecated attribute | N2334 | Clang 9 |
Attributes | ||
N2335 | Clang 9 | |
N2554 | Clang 9 | |
Defining new types in offsetof | N2350 | Yes |
fallthrough attribute | N2408 | Clang 9 |
Two's complement sign representation | N2412 | Unknown |
Adding the u8 character prefix | N2418 | No |
Remove support for function definitions with identifier lists | N2432 | No |
*_IS_IEC_60559 feature test macros | N2379 | Unknown |
Floating-point negation and conversion | N2416 | Unknown |
Annex F.8 update for implementation extensions and rounding | N2384 | Unknown |
_Bool definitions for true and false | N2393 | No |
[[nodiscard("should have a reason")]] | N2448 | Clang 10 |
Allowing unnamed parameters in function definitions | N2480 | Clang 11 |
Free positioning of labels inside compound statements | N2508 | No |
Clarification request for C17 example of undefined behavior | N2517 | No |
Querying attribute support | N2553 | Clang 9 |
Binary literals | N2549 | Clang 9 |
Allow duplicate attributes | N2557 | Clang 13 |
Character encoding of diagnostic text | N2563 | Yes |
What we think we reserve | N2572 | Partial |
Decimal floating-point triples | N2580 | Unknown |
Remove mixed wide string literal concatenation | N2594 | Clang 9 |
Update to IEC 60559:2020 | N2600 | Unknown |
Compatibility of Pointers to Arrays with Qualifiers | N2607 | Partial |