On Thu, Aug 14, 2025 at 12:44 AM uso ewin <uso.cosmo....@gmail.com> wrote:

>
>
> On Wed, Aug 13, 2025 at 9:48 PM grischka via Tinycc-devel <
> tinycc-devel@nongnu.org> wrote:
>
>> On 11.08.2025 05:20, uso ewin wrote:
>> > My first code had a bug with an array declared in if.
>> > It should be fixed, here:
>> > https://github.com/cosmo-ray/tcc/commits/c2y-if-switch-decl/
>> >
>> > The patch is pretty unlikely to bring a new bug to existing code,
>> > as, new code should be called only if we're in a declaration inside an
>> if
>> > or a switch.
>> >
>> > I've also added more tests.
>> > Anyway, I'd like to know if there is something wrong with the patch,
>> > or if someone is against having this in Tinycc.
>> >
>> > If no one answer this, I'll push to mob in 1 week. (so the 17/08)
>>
>> Forget that 'keep_on_stack' idea. That will never work correctly.
>> Instead let decl() return the token 'v' and push that on stack.
>>
>> I did fix my code base on your review:
> It is here:
>
> https://github.com/cosmo-ray/tcc/commit/137a7495c5c63251a29975285a6774c3adf75819
> It is indeed a lot cleaner.
>
> See: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3580.htm
>> if (T x = y) { ...
>> // is ALWAYS the same as
>> if (T x = y; x) { ...
>>
>> Also please, no extra variables or parameters, no clauses at the
>> top of functions, no error messages, no copy & paste code, no tests.
>>
>
> But check against gcc.  We don't want people say "works in gcc, tcc
>> gives me error" ;)
>>
>
> -- gr
>>
>> I've removed the "copy & paste code", by creating a new function,
> called "condition_expresion", Which is called instead of gexpr
> in if and switch parsing.
> I move the tests in another commit, so I don't have to push them on mob.
>
> The only thing I've kept are the error message, as they are the same error
> messages
> as the one show by gcc.
> As only one variable can be declared inside a condition, and that variable
> have to be initialized,
> I don't see how I could make the code work without an error.
>
>
> Thanks a lot for the review,
>
> Matthias
>
> So if no one answer, I push in the code in one week, so the 22.
I could remove the error, that would make tinycc accept more declarations
that gcc,
so if you prefer that, tell me.

Also, I won't push the test as ask by grischka, but if you want I can push
them in another
commit, so they are easier to revert, they're here:
https://github.com/cosmo-ray/tcc/commit/08f8ed60a9241d4a13d27b5a932ca667a0be438b

Matthias

>
>> > Matthias
>>
>> _______________________________________________
>> Tinycc-devel mailing list
>> Tinycc-devel@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>>
>
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to