Commit Graph

2 Commits

Author SHA1 Message Date
Christopher Bazley
1f214e1390 tccgen: stop ignoring qualifiers in array-like parameters
To ensure that qualifiers within an array-style
parameter declaration (e.g. int [const 2] are handled
correctly, post_type() is modified to collect qualifiers
and OR them into the t member of CType.

The new test for restrict also passes, but only
because the restrict keyword is ignored.
2026-09-26 12:18:03 +01:00
Christopher Bazley
5f1425ef21 tccgen: preserve adjusted parameter qualifiers
Previously, TCC wrongly discarded the const and
volatile qualifiers from parameter types when
adjusting them.

- convert_parameter_type() will no longer remove
  the const and volatile qualifiers from a CType.
- a new function, convert_expression_type(), will
  remove the const and volatile qualifiers before
  tail-calling convert_parameter_type().
- unary() and gexpr() will call
  convert_expression_type() instead of
  convert_parameter_type() to ensure that
  expression semantics are unchanged.

The new tests for restrict also pass, but only
because the restrict keyword is ignored.
2026-09-26 12:18:03 +01:00