On Mon, Oct 30, 2023 at 08:41:13AM +0100, Reimar Döffinger wrote:
> My reason for implementing it is compatibility.
> Quite a few projects will default to thin archives, and if you configure them
> for CC=tcc they will fail to compile because of it.
> They test for ar support of thin archives, but I don't think any of them
> test if the compiler supports it...

This looks to me like bugs in the corresponding projects?..
(we shouldn't put code into tcc to work around someone else's *bugs*)

> Now setting AR="tcc -ar" generally works, but it's an extra hurdle for
> trying to get a project to compile.

Setting this kind of variables is a well established way of dealing with
different toolchains. I would see this as reasonable.

> Though maybe just detecting thin archives (instead of just saying that
> the format is not recognized) and printing instructions may work well enough
> as an alternative.

This can be a practical compromise.

Still, as far as personal opinions matter, I would prefer this to be
put into the documentation rather than into the code.

> > Would it be too much to ask for making this addition a compile-time choice?
> 
> Since the reason for it is compatibility, not a new feature per se,
> I would not like that.
> For compatibility features not having it at all (and force
> people to deal with it) might be better than having it conditional.

I agree. Having the extra code and the extra choice to make (whether to
use that part of code) is a practical burden and harmful extra complexity.

I hope someone else on the list will raise their opinion about how much
trouble thin archives present for tcc and what level of support/detection
is worth while.

> >         if (0 == memcmp(h, ARMAG, 8))
> >             return AFF_BINTYPE_AR;
> > +        if (0 == memcmp(h, "!<thin>\n", 8))
> > +            return AFF_BINTYPE_AR;
> > "!<thin>\n" looks like a candidate for a symbolic name not unlike ARMAG ?)
> 
> It seemed overkill at first since it was only used in one place,
> but now that it's used in 2 places, yes.

I thought about consistency, when two operations with identical semantics
are being done, it is easier to follow the logic when they look like
each other as well.

Kind regards,
/tccm

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

Reply via email to