Dear TCC developers, This patch adds support for the _Optional type qualifier specified by draft ISO/IEC TS 26716 (WG14 document N3951). It builds on qualifier fixes that I previously made in mob and improves source compatibility with SDCC, which already supports _Optional.
The qualifier applies to the referenced type: a pointer is not optional merely because it can have a null value, any more than a pointer is const merely because it can reference an immutable object. A null pointer value can be copied, printed or converted, whereas an optional pointer object can be absent, in which case it has neither value nor allocated storage. The qualifier was specifically designed to be useful even without flow-sensitive analysis, through its type and conversion rules. This implementation covers parsing, type compatibility, conversions and constraints on declarations. TCC does not perform flow-sensitive analysis to determine whether an optional object is present. The qualifier has no runtime representation or ABI effect. The tests cover valid uses and required diagnostics, including array qualification and conversion cases that have exposed bugs in SDCC. The full TCC test suite passes on Linux x86-64 and also on macOS AArch64. I pushed the patch as commit 8b58a07b95a6. The implementation changes 100 lines across three source files, with another 12 lines of documentation. Most of the patch consists of tests. Thanks, Christopher _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
